Invert the x-cache header logic
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
services:
|
||||
nginx-cache-proxy:
|
||||
# image: docker.site.quack-lab.dev/nginx-cache-proxy:latest
|
||||
image: nginx:alpine
|
||||
# image: nginx:alpine
|
||||
image: docker.site.quack-lab.dev/nginx-cache-proxy:latest
|
||||
ports:
|
||||
- "3001:3001"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./nginx-data:/etc/nginx/data
|
||||
restart: unless-stopped
|
||||
# - ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- nginx-data:/etc/nginx/data
|
||||
|
||||
volumes:
|
||||
nginx-data:
|
||||
11
nginx.conf
11
nginx.conf
@@ -32,14 +32,13 @@ http {
|
||||
|
||||
proxy_cache api_cache;
|
||||
proxy_cache_valid 200 365d;
|
||||
proxy_cache_bypass $http_x_cache_this_inverse;
|
||||
proxy_no_cache $http_x_cache_this_inverse;
|
||||
proxy_cache_bypass $http_x_cache_inverse;
|
||||
proxy_no_cache $http_x_cache_inverse;
|
||||
|
||||
set $http_x_cache_this_inverse 1;
|
||||
if ($http_x_cache_this) {
|
||||
set $http_x_cache_this_inverse 0;
|
||||
set $http_x_cache_inverse 1;
|
||||
if ($http_x_cache) {
|
||||
set $http_x_cache_inverse 0;
|
||||
}
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status always;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user