Problems with cache by mime/type
Jorge Pereira
jpereiran at gmail.com
Thu Nov 29 23:51:13 UTC 2018
Hi,
I am using the nginx/1.12.0 and I am trying to use the below config.
but, the below "map" by "$upstream_http_content_type" is always
matching with default value "1". but, if I remove "proxy_cache_bypass"
then the map it works. therefore, I need the "proxy_cache_bypass "
capability.
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
map $sent_http_content_type $no_cache {
default 1;
application/zip 0; # *.zip files
application/octet-stream 0; # /artifactory/api/pypi and any
other binary files.
application/java-archive 0; # *.jar
application/x-nupkg 0; # /artifactory/api/nuget/.*/Download/.*
}
proxy_cache_path $CACHE_FOLDER
levels=1:2
keys_zone=artifactory_cache:$CACHE_KEYS_SIZE
max_size=$CACHE_SIZE
inactive=$CACHE_DURATION
use_temp_path=off;
server {
listen 80;
server_name mywww.lan;
set $upstream https://172.16.0.1/artifactory;
proxy_read_timeout 10;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_next_upstream http_503 non_idempotent;
proxy_set_header Host $http_host;
proxy_cache artifactory_cache;
proxy_cache_bypass $no_cache;
proxy_no_cache $no_cache;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_cache_key $scheme$proxy_host$request_uri$auth_cache_key;
proxy_cache_valid 200 24h;
proxy_ignore_headers "Set-Cookie" "Cache-control";
location ~/mypath(?<relative_uri>.*)$ {
proxy_pass $upstream${relative_uri}${is_args}${args};
}
}
}
--
Jorge Pereira
More information about the nginx
mailing list