Add support for X-Ccache-Purge to well...
This commit is contained in:
15
nginx.conf
15
nginx.conf
@@ -32,7 +32,7 @@ http {
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH";
|
||||
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Cache,X-NoCache,X-Status";
|
||||
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Cache,X-Cache-Purge,X-Status";
|
||||
add_header Access-Control-Max-Age 86400;
|
||||
return 204;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ http {
|
||||
# CORS headers — replace with our own *
|
||||
add_header Access-Control-Allow-Origin * always;
|
||||
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH" always;
|
||||
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Cache,X-NoCache,X-Status" always;
|
||||
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Cache,X-Cache-Purge,X-Status" always;
|
||||
add_header Access-Control-Expose-Headers "X-Cache-Status" always;
|
||||
|
||||
proxy_cache api_cache;
|
||||
@@ -106,12 +106,11 @@ http {
|
||||
# Ignore headers that would prevent storing the response
|
||||
proxy_ignore_headers Cache-Control Expires Set-Cookie Vary X-Accel-Expires X-Accel-Redirect;
|
||||
|
||||
# Bypass cache for this request (and do not store): send X-NoCache or X-Cache-Invalidate (any value)
|
||||
set $skip_cache 0;
|
||||
if ($http_x_nocache != "") { set $skip_cache 1; }
|
||||
if ($http_x_cache_invalidate != "") { set $skip_cache 1; }
|
||||
proxy_cache_bypass $skip_cache;
|
||||
proxy_no_cache $skip_cache;
|
||||
# X-Cache-Purge: bypass cache for this request (don't serve cached) but DO store the new response (overwrites that key)
|
||||
set $bypass_cache 0;
|
||||
if ($http_x_cache_purge != "") { set $bypass_cache 1; }
|
||||
proxy_cache_bypass $bypass_cache;
|
||||
proxy_no_cache 0;
|
||||
|
||||
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user