Welcome! Log In Create A New Profile

Advanced

Re: Cache only static files in sub/subfolder but not sub

February 22, 2017 11:01AM
Hi Francis

You're right I have overseen the ^~ for the location.

So for others, the solution to "force" the location directives is..


location ^~ /thumbs/embedded {
add_header X-Served-By "IDENT1";
add_header Cache-Control public;
add_header Pragma 'public';
add_header X-Cache-Status $upstream_cache_status;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
error_page 404 = /image404.php;
proxy_pass http://127.0.0.1:9001;
}

##Match what's not in above location directive
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
#access_log on;
#log_not_found on;
aio on;
sendfile on;
expires max;
add_header Cache-Control public;
add_header Pragma 'public';
add_header X-Served-By "IDENT2";
#add_header X-Frame-Options SAMEORIGIN;
error_page 404 = /image404.php;
}


The quick view is that
location /thumbs/embedded {

change into

location ^~ /thumbs/embedded {

Pretty cool actually :)
Subject Author Posted

Cache only static files in sub/subfolder but not sub

JoakimR February 19, 2017 02:53PM

Re: Cache only static files in sub/subfolder but not sub

JoakimR February 20, 2017 07:52AM

Re: Cache only static files in sub/subfolder but not sub

Francis Daly February 20, 2017 02:08PM

Re: Cache only static files in sub/subfolder but not sub

JoakimR February 22, 2017 11:01AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 203
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