1
Fork 0
An nginx config to cache unsplash, to get around their very annoying rate limit https://hub.docker.com/r/theorangeone/unsplash-cache
This repository has been archived on 2026-05-19. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
2024-07-02 21:44:47 +01:00
.github/workflows Update docker/build-push-action action to v6 2024-07-02 21:44:47 +01:00
docker-compose.yml Init container 2023-03-19 21:06:26 +00:00
Dockerfile Override default config 2023-03-20 12:38:40 +00:00
LICENSE Initial commit 2023-03-19 20:56:23 +00:00
nginx.conf Detect IP address correctly 2023-03-20 12:34:04 +00:00
README.md Document caching stats 2023-03-19 21:57:54 +00:00
renovate.json Disable dependency dashboard 2023-03-19 22:08:04 +00:00

unsplash-cache

An nginx config to cache unsplash, 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

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