image-proxy

Configuration

Environment variables reference

All configuration is done through environment variables.

Server

VariableDefaultDescription
IMAGE_PROXY_BIND_ADDRESS0.0.0.0:8000TCP address and port to listen on
IMAGE_PROXY_ROOT_PATH/app/dataRoot directory for serving image files
IMAGE_PROXY_STRIP_PATH(unset)Path prefix to strip from incoming requests. Useful when behind a reverse proxy that adds a prefix.
RUST_LOGINFOLog level (TRACE, DEBUG, INFO, WARN, ERROR)

Fallback

VariableDefaultDescription
IMAGE_PROXY_FALLBACK_IMAGE_URL(unset)Base URL for fetching images not found on disk (e.g., https://cdn.example.com/images/)
IMAGE_PROXY_FALLBACK_IMAGE_MAX_SIZE5242880 (5 MB)Maximum size in bytes for fallback image responses. Prevents excessive memory usage.
IMAGE_PROXY_USER_AGENTimage-proxy/<version>User-Agent header sent when fetching fallback images from an upstream. Loaded into EncodingConfig; empty/whitespace falls back to default.

Encoding

See Formats for details on each format's quality and speed parameters.

VariableDefaultRangeDescription
IMAGE_PROXY_AVIF_QUALITY850–100AVIF quality
IMAGE_PROXY_AVIF_SPEED61–10AVIF encoder speed
IMAGE_PROXY_JPEG_QUALITY750–100JPEG quality
IMAGE_PROXY_WEBP_QUALITY800–100WebP quality
IMAGE_PROXY_WEBP_EFFORT40–6WebP compression effort
IMAGE_PROXY_WEBP_LOSSLESSfalseboolWebP lossless encoding
IMAGE_PROXY_JXL_QUALITY750–100JPEG XL quality
IMAGE_PROXY_JXL_SPEED61–10JPEG XL encoder speed
IMAGE_PROXY_JXL_LOSSLESSfalseboolJPEG XL lossless encoding
IMAGE_PROXY_PNG_COMPRESSION_LEVEL60–9PNG compression level

Resize

VariableDefaultOptionsDescription
IMAGE_PROXY_RESIZE_ALGORITHMautoauto, lanczos3, bicubic, gaussian, thumbnailDefault resize algorithm. Can be overridden per-request.

Safety Limits

Guards against decompression bombs and out-of-memory conditions. Set any of these to 0 to disable that specific check (not recommended).

VariableDefaultDescription
IMAGE_PROXY_MAX_DIMENSION8192Maximum allowed image width or height in pixels. Images declaring larger dimensions are rejected before a pixel buffer is allocated.
IMAGE_PROXY_MAX_SOURCE_SIZE104857600 (100 MB)Maximum on-disk source file size in bytes. Files larger than this are rejected with 413 Payload Too Large before being read into memory. Note: this limit only applies to requests that require decoding or transformation; pass-through requests (no query parameters, source format matches the requested format) stream the file directly without loading it into memory, so the size limit does not apply to them.

Format Selection

VariableDefaultDescription
IMAGE_PROXY_PREFERRED_FORMATS(unset)Comma-separated list of preferred output formats for automatic format selection (e.g., avif,webp). Leaving this field empty disables automatic format selection.
IMAGE_PROXY_ALLOWED_OUTPUT_FORMATS(unset)Comma-separated list of allowed output formats. Requests for unlisted formats get 415. When unset, all formats are allowed. Leaving this field empty allows all formats.

Caching

See Caching for detailed information.

VariableDefaultDescription
IMAGE_PROXY_ENABLE_CACHEfalseEnable response caching
IMAGE_PROXY_CACHE_MEMORY_SIZE104857600 (100 MB)In-memory cache capacity in bytes
IMAGE_PROXY_CACHE_MAX_ITEM_SIZE1048576 (1 MB)Maximum size of a single cached item. Larger items are not cached.
IMAGE_PROXY_ENABLE_DISK_CACHEfalseEnable disk-backed cache (requires ENABLE_CACHE=true)
IMAGE_PROXY_CACHE_DISK_SIZE536870912 (512 MB)Pre-allocated disk cache capacity in bytes
IMAGE_PROXY_CACHE_DISK_PATH./cacheDirectory for disk cache files

HTTP Headers

VariableDefaultDescription
IMAGE_PROXY_CACHE_CONTROL_HEADERpublic, max-age=31536000, no-transformValue for the Cache-Control response header. Set to empty string to disable.
IMAGE_PROXY_CACHE_STATUS_HEADERX-Image-Proxy-CacheName of the response header indicating cache status (HIT/MISS).

On this page