You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cache/external.mdx
+20-12Lines changed: 20 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,10 @@ Most major CDNs (Cloudflare, Fastly, AWS CloudFront, Akamai, etc.) can cache img
12
12
13
13
### Recommended CDN settings
14
14
15
-
***Origin shield** - Add a secondary cache layer between your CDN and imgproxy origin
16
15
***Image optimization** - Disable CDN image optimization to avoid double-processing
17
-
***Compression** - Enable gzip/Brotli compression for bandwidth savings
18
-
***HTTP/2 Server Push** - Push critical images to reduce latency
16
+
***Compression** - In case your CDN supports conditional compression of SVG images, enable gzip/Brotli compression for bandwidth savings
17
+
***Include essential headers*** - It's strongly recommended to include `Accept` header in the cache key. If you have client hints enabled, include also `DPR`, `Sec-CH-Dpr`, and `Sec-CH-Width` headers.
18
+
***Origin shield** - Add a secondary cache layer between your CDN and imgproxy origin if your CDN supports it.
19
19
20
20
## nginx caching
21
21
@@ -32,16 +32,24 @@ server {
32
32
listen 80;
33
33
server_name images.example.com;
34
34
35
-
# Include request and feature signals that can change imgproxy output
@@ -65,7 +73,7 @@ The exact key depends on which imgproxy features can change output for the same
65
73
proxy_cache_key "$scheme$proxy_host$request_uri";
66
74
```
67
75
68
-
2. Include format negotiation signal when WebP/AVIF/JXL preference can vary by client:
76
+
2. Include [format negotiation](../configuration/options.mdx#avifwebpjpeg-xl-support-detection) signal when WebP/AVIF/JXL preference can vary by client:
Copy file name to clipboardExpand all lines: docs/cache/internal/amazon_s3.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,8 @@ imgproxy can store cached images in Amazon S3 buckets or S3-compatible storage.
8
8
9
9
1. Set the `IMGPROXY_CACHE_USE` environment variable to `s3`.
10
10
2.[Set up the necessary credentials](#set-up-credentials) to grant access to your cache bucket.
11
-
3._(optional)_Specify the AWS region with `IMGPROXY_CACHE_S3_REGION`. Default: `us-west-1`
12
-
4._(optional)_ Specify the cache bucket name with `IMGPROXY_CACHE_BUCKET`.
11
+
3. Specify the cache bucket name with `IMGPROXY_CACHE_BUCKET`.
12
+
4._(optional)_ Specify the AWS region with `IMGPROXY_CACHE_S3_REGION` or `AWS_REGION`. Default: `us-west-1`
13
13
5._(optional)_ Specify the S3 endpoint with `IMGPROXY_CACHE_S3_ENDPOINT`. You can also set `IMGPROXY_CACHE_S3_ENDPOINT_USE_PATH_STYLE=false` to use the virtual host style for the endpoint.
14
14
6._(optional)_ Specify the AWS IAM Role to Assume with `IMGPROXY_CACHE_S3_ASSUME_ROLE_ARN`.
15
15
7._(optional)_ Specify the External ID to pass to the AWS IAM Role when assuming it using `IMGPROXY_CACHE_S3_ASSUME_ROLE_EXTERNAL_ID`. This will have no effect if the assume role ARN is not specified.
Copy file name to clipboardExpand all lines: docs/cache/internal/local_filesystem.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ description: Learn about how to configure the local filesystem cache in imgproxy
6
6
7
7
imgproxy can store cached images on the local filesystem. To use filesystem cache, do the following:
8
8
9
-
1. Set the `IMGPROXY_CACHE_USE` environment variable to the filesystem.
9
+
1. Set the `IMGPROXY_CACHE_USE` environment variable to `fs`.
10
10
2. Set `IMGPROXY_CACHE_LOCAL_FILESYSTEM_ROOT` to your cache directory path.
11
11
3._(optional)_ Specify a path prefix for cache files with `IMGPROXY_CACHE_PATH_PREFIX`.
12
12
@@ -25,5 +25,5 @@ imgproxy can store cached images on the local filesystem. To use filesystem cach
25
25
Assume you want to cache processed images in `/var/cache/imgproxy`. Run imgproxy with `IMGPROXY_CACHE_LOCAL_FILESYSTEM_ROOT` set to your cache directory:
*[`IMGPROXY_PATH_PREFIX`]: the URL path prefix. Example: when set to `/abc/def`, the imgproxy URL will be `/abc/def/%signature/%processing_options/%source_url`. Default: blank
49
49
*[`IMGPROXY_USER_AGENT`]: the User-Agent header that will be sent with the source image request. You can use the `%current_version` variable to insert the current imgproxy version. Default: `imgproxy/%current_version`
50
50
*[`IMGPROXY_USE_ETAG`]: when set to `true`, enables using the [ETag](https://en.wikipedia.org/wiki/HTTP_ETag) HTTP header for HTTP cache control. Default: `false`
51
-
*[`IMGPROXY_ETAG_BUSTER`]: a global ETag buster value. Change it to invalidate old ETags and prevent`304 Not Modified` responses for stale client/CDN validators. Default: blank
51
+
*[`IMGPROXY_ETAG_BUSTER`]: a global ETag buster value. Change this value if you update configuration that affects image processing, to invalidate old ETags and avoid`304 Not Modified` responses from stale client/CDN validators. Default: blank
52
52
*[`IMGPROXY_USE_LAST_MODIFIED`]: when set to `true`, enables using the [Last-Modified](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified) HTTP header for HTTP cache control. Default: `false`
53
-
*[`IMGPROXY_LAST_MODIFIED_BUSTER`]: a global `Last-Modified` buster timestamp. If incoming `If-Modified-Since` is older than this value, imgproxy ignores it and forces revalidation; if origin `Last-Modified` is older, imgproxy replaces it with this timestamp. Use it to invalidate stale client/CDN `Last-Modified` validators after global processing changes. Default: `0`
53
+
*[`IMGPROXY_LAST_MODIFIED_BUSTER`]: a global `Last-Modified` buster timestamp in [RFC3339](https://www.rfc-editor.org/rfc/rfc3339.html) format. By setting it to a specific datetime, you can make imgproxy treat all the images as if they were modified at least at that datetime. Default: blank
54
54
*[`IMGPROXY_CUSTOM_REQUEST_HEADERS`]: ((pro)) list of custom headers that imgproxy will send while requesting the source image, divided by `\;` (can be redefined by `IMGPROXY_CUSTOM_HEADERS_SEPARATOR`). Example: `X-MyHeader1=Lorem\;X-MyHeader2=Ipsum`
55
55
*[`IMGPROXY_CUSTOM_RESPONSE_HEADERS`]: ((pro)) a list of custom response headers, separated by `\;` (can be redefined by `IMGPROXY_CUSTOM_HEADERS_SEPARATOR`). Example: `X-MyHeader1=Lorem\;X-MyHeader2=Ipsum`
56
56
*[`IMGPROXY_CUSTOM_HEADERS_SEPARATOR`]: ((pro)) a string that will be used as a custom header separator. Default: `\;`
@@ -167,8 +167,6 @@ When using imgproxy in a development environment, it can be useful to ignore SSL
167
167
168
168
Also you may want imgproxy to respond with the same error message that it writes to the log:
169
169
170
-
*[`IMGPROXY_DEVELOPMENT_ERRORS_MODE`]: when `true`, imgproxy will respond with detailed error messages. Not recommended for production because some errors may contain stack traces.
171
-
172
170
*[`IMGPROXY_ALLOW_SECURITY_OPTIONS`]: when `true`, allows usage of security-related processing options such as `max_src_resolution`, `max_src_file_size`, `max_animation_frames`, `max_animation_frame_resolution`, and `max_result_dimension`. Default: `false`.
173
171
174
172
:::warning
@@ -423,24 +421,24 @@ imgproxy can detect objects on the image and use them to perform smart cropping,
423
421
424
422
Read the [Object Detection guide](../features/object_detection.mdx) for more info.
425
423
426
-
## Object classification
424
+
## Classification
427
425
428
-
imgproxy can classify detected objects on the image and provide detailed information about what the objects are.
426
+
imgproxy can classify images by assigning them to predefined categories based on their overall content, similar to object detection but without identifying or locating individual objects.
429
427
430
-
*[`IMGPROXY_OBJECT_CLASSIFY_NET`]: ((pro)) a path to the classification neural network model in ONNX format. Default: blank
431
-
*[`IMGPROXY_OBJECT_CLASSIFY_CLASSES`]: ((pro)) the path to the text file with the class names, one per line. Default: blank
432
-
*[`IMGPROXY_OBJECT_CLASSIFY_NET_SIZE`]: ((pro)) the size of the neural network input. The width and the heights of the inputs should be the same, so this config value should be a single number. Default: 224
433
-
*[`IMGPROXY_OBJECT_CLASSIFY_THRESHOLD`]: ((pro)) classifications with confidence below this value will be discarded. Default: 0.5
434
-
*[`IMGPROXY_OBJECT_CLASSIFY_NORMALIZATION`]: ((pro)) the normalization type to apply to the input image. Possible values are:
428
+
*[`IMGPROXY_CLASSIFICATION_NET`]: ((pro)) a path to the classification neural network model in ONNX format. Default: blank
429
+
*[`IMGPROXY_CLASSIFICATION_CLASSES`]: ((pro)) the path to the text file with the class names, one per line. Default: blank
430
+
*[`IMGPROXY_CLASSIFICATION_NET_SIZE`]: ((pro)) the size of the neural network input. The width and the heights of the inputs should be the same, so this config value should be a single number. Default: 224
431
+
*[`IMGPROXY_CLASSIFICATION_THRESHOLD`]: ((pro)) classifications with confidence below this value will be discarded. Default: 0.5
432
+
*[`IMGPROXY_CLASSIFICATION_NORMALIZATION`]: ((pro)) the normalization type to apply to the input image. Possible values are:
435
433
*`none`: _(default)_ no normalization
436
-
*`half`: normalize to [-0.5, 0.5] range
434
+
*`half`: normalize to [0, 1] range
437
435
*`full`: normalize to [-1, 1] range
438
436
*`imagenet`: normalize using ImageNet mean and standard deviation
439
-
*[`IMGPROXY_OBJECT_CLASSIFY_LAYOUT`]: ((pro)) the data layout of the neural network input. Possible values are:
440
-
*`nchw`: _(default)_channels first
441
-
*`nhwc`: channels last
437
+
*[`IMGPROXY_CLASSIFICATION_LAYOUT`]: ((pro)) the data layout of the neural network input. Possible values are:
438
+
*`nchw`: channels first (PyTorch default)
439
+
*`nhwc`: _(default)_channels last (TensorFlow default)
442
440
443
-
Read the [Object Classification guide](../features/object_classification.mdx) for more info.
441
+
Read the [Classification guide](../features/classification.mdx) for more info.
444
442
445
443
## Cache
446
444
@@ -453,9 +451,11 @@ imgproxy can cache processed images in various storage backends to improve perfo
453
451
*[`IMGPROXY_CACHE_KEY_COOKIES`]: ((pro)) a comma-separated list of HTTP request cookies to include in the cache key. This allows caching different versions of the same image based on cookies. Default: blank
454
452
*[`IMGPROXY_CACHE_REPORT_ERRORS`]: ((pro)) when `true`, imgproxy will report cache errors instead of silently falling back to processing without cache. Default: `false`
455
453
454
+
Read the [Internal cache guide](../cache/internal.mdx) for more info.
455
+
456
456
### Local filesystem {#cache-storage-local-filesystem}
457
457
458
-
imgproxy can store cached images on the local filesystem. To use [filesystem cache](../cache/internal/local_filesystem.mdx), set `IMGPROXY_CACHE_USE` to `filesystem`:
458
+
imgproxy can store cached images on the local filesystem. To use [filesystem cache](../cache/internal/local_filesystem.mdx), set `IMGPROXY_CACHE_USE` to `fs`:
459
459
460
460
*[`IMGPROXY_CACHE_LOCAL_FILESYSTEM_ROOT`]: ((pro)) the root directory for filesystem cache. Default: blank
461
461
@@ -508,8 +508,6 @@ imgproxy can store cached images in OpenStack Object Storage (Swift). To use [Sw
508
508
*[`IMGPROXY_CACHE_SWIFT_TIMEOUT_SECONDS`]: ((pro)) the data channel timeout in seconds for cache operations. Default: 60
509
509
*[`IMGPROXY_CACHE_SWIFT_CONNECT_TIMEOUT_SECONDS`]: ((pro)) the connect channel timeout in seconds for cache operations. Default: 10
510
510
511
-
Read the [Internal cache guide](../cache/internal.mdx) for more info.
512
-
513
511
## Fallback image
514
512
515
513
You can set up a fallback image that will be used in case imgproxy is unable to fetch the requested one. Use one of the following variables:
0 commit comments