image-proxy/README.md
2024-02-08 00:41:17 +01:00

1.2 KiB

image-proxy

An image proxy server that resizes images before serving them. Intended to only be used with images that already have a consistent size (such as already processed avatars).

Configuration

Configuration is done in a config.json file, with the following keys:

  • port: the port the server will listen on
  • debug: whether the server will log all request paths and durations
  • proxy_target: the target for the reverse proxy, used when the requested size is the image's actual size. Should be the full base URL of the target server, without a trailing slash.
  • patterns: an array of patterns to accept
    • input: (string) the input regex. This should start with a / and use unnamed capture groups.
    • output: (string) the URL to rewrite the link to, using $1 $2 (etc) as placeholders for the capture groups.
    • cache_key: (string) the file name used for cached files. Must be unique across all patterns.
    • content_type: (string) the Content-Type header to return with requests.
    • sizes: (array of numbers) the acceptable sizes for this pattern. The first size in the list is the default, and will be passed through unmodified.

To-do list

  • Clean up old, unused cache entries