Welcome! Log In Create A New Profile

Advanced

Help with Location Directives needed

September 10, 2010 05:52AM
Hi,
i am having some troubles with location directives. As only the first matching location directive is executed (if there is no rewrite of course) i have to do a little hack to get my config to work. This currently looks like this:

location ~ "^/(js|css|audio)/(.*)" {
add_header "Header1" "Value1";
if ($args !~ ^$) {
add_header "Header1" "Value1";
expires max;
}
}

location ~ "^/img/(.*)" {
if ($args !~ ^$) {
expires max;
}
}
this works for now :)
what i actually only want to achieve:
- set expires max for all files in img js css audio if some query params are set (in this case just some value for cache busting purposes)
- set the Header1 if the file lies in js css audio

In this current config this is quite tricky as i have to set both headers in seperatetly for every case.
Is there any way this config can be optimized? It would be really nice if something like this would work:
location ~ "^/(js|css|audio|img)/(.*)" {
if ($args !~ ^$) {
expires max;
}
}

location ~ "^/(js|css|audio)/(.*)" {
add_header "Header1" "Value1";
}

Any ideas?

Sebastian
Subject Author Posted

Help with Location Directives needed

tmsmaster September 10, 2010 05:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 86
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready