https://github.com/realorangeone/unsplash-cache
An nginx config to cache unsplash, to get around their very annoying rate limit
https://github.com/realorangeone/unsplash-cache
cache nginx unsplash
Last synced: 3 months ago
JSON representation
An nginx config to cache unsplash, to get around their very annoying rate limit
- Host: GitHub
- URL: https://github.com/realorangeone/unsplash-cache
- Owner: RealOrangeOne
- License: mit
- Created: 2023-03-19T20:56:22.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-02T20:44:50.000Z (almost 2 years ago)
- Last Synced: 2025-01-12T04:12:36.640Z (over 1 year ago)
- Topics: cache, nginx, unsplash
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/theorangeone/unsplash-cache
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unsplash-cache
An nginx config to cache [unsplash](DOCKERHUB_TOKEN), to get around their very annoying rate limit
Unsplash has a rate limit of 50 requests per hour for unverified API clients. Their verification process is rather complex (and the use case of a static-site generator is apparently unheard off), so there needs to be an alternative.
This `nginx` config (and resulting Docker container) caches Unsplash's API, allowing it to act as a centralised cache for API requests, bypassing the API restrictions. A valid API token is still required.
## Usage
```yml
version: "2.3"
services:
web:
image: theorangeone/unsplash-cache:latest
tmpfs:
- /tmp/unsplash-cache
ports:
- "80:80"
```
If you want the cache to persist between container restarts, mount `/tmp/unsplash-cache` to a given directory.
Instead of sending requests to `api.unsplash.com`, send them to this container instead.
## Caching
- Cached responses are kept for 21 days.
- The cache cannot grow beyond 1GB.
- The cache key size should store around 10k records