Conditional expires in location

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Conditional expires in location

S.A.N
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

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,273434,273434#msg-273434

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Loading...