Welcome! Log In Create A New Profile

Advanced

Help getting regexp to match to set expires headers

Tim Wong
February 06, 2010 08:58PM
Hi there,

I'm trying to get nginx to set expires headers only for assets that have
timestamps at the end of them but am having trouble figuring out exactly
what to put in the conf file. Would anybody be able to help me out?

Here's what I've tried:

# Trying to set expires headers for /test.png?1265332681 but not for /test.png

# Works for /test.png?1265332681 but also matches /test.png
location ~* \.(htc|ico|css|js|gif|jp?g|png)(\?[0-9]+)?$ {
expires max;
break;
}

# No expires headers set
location ~* \.(ico|css|js|gif|jp?g|png)(\?[0-9]+)$ {
expires max;
break;
}


Thanks,
Tim
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Help getting regexp to match to set expires headers

Tim Wong February 06, 2010 08:58PM

Re: Help getting regexp to match to set expires headers

Maxim Dounin February 06, 2010 09:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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