Welcome! Log In Create A New Profile

Advanced

Conditional expires in location

April 05, 2017 06:14PM
Hi everyone,

I have a generic location that servers many others via rewrite/proxy_pass. The generic location calls expires by including a file which disables caching. I have new location with its own expiration logic that needs to bypass this. What is the best way to do this?

# Generic service.
location = /generic.js {
fastcgi_pass 'unix:/tmp/generic.socket';
include fastcgi.conf;
# only does: expires -1s;
include expires.conf;
}

location = /new.js {
set $new_upstream https://new.lskjdflsj.com/;
rewrite ^/new.js /generic.js?type=new;
proxy_pass $new_upstream;
}


I've read that if statements are undesirable in location although that seems to work. I've also tried setting an expires variable via a map which also works. But doesn't this execute for every request?

Zach
Subject Author Posted

Conditional expires in location

phwaap April 05, 2017 06:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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