Welcome! Log In Create A New Profile

Advanced

Problems with cache by mime/type

Jorge Pereira
November 29, 2018 06:52PM
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
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Problems with cache by mime/type

Jorge Pereira November 29, 2018 06:52PM

Re: Problems with cache by mime/type

Francis Daly November 30, 2018 08:14AM

Re: Problems with cache by mime/type

Jorge Pereira November 30, 2018 08:34AM

Re: Problems with cache by mime/type

Francis Daly November 30, 2018 09:06AM

Re: Problems with cache by mime/type

Jorge Pereira November 30, 2018 09:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 297
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready