Adding expires but not show up in headers

Hi,

I added a expires as follow:

location ~ ^/images/ {
root /var/www
expires max;
}

if I do a curl -I http://localhost/images/sample.jpg, I got following
headers, but can not find the “Expires” in the headers, what I did wrong
here? Thanks.

HTTP/1.1 200 OK
Server: nginx/1.4.1
Date: Wed, 19 Jun 2013 03:52:13 GMT
Content-Type: image/jpeg
Content-Length: 17584
Last-Modified: Wed, 19 Jun 2013 02:12:31 GMT
Connection: keep-alive
ETag: “51c1138f-44b0”
Accept-Ranges: bytes

Posted at Nginx Forum:

On Wed, Jun 19, 2013 at 12:03:35AM -0400, angelochen960 wrote:

Hi there,

location ~ ^/images/ {
root /var/www
expires max;
}

if I do a curl -I http://localhost/images/sample.jpg, I got following
headers, but can not find the “Expires” in the headers, what I did wrong
here? Thanks.

What other “location” lines do you have for this server? Only one of
them will be used for the request /images/sample.jpg.

f

Francis D. [email protected]

there is another one, but more specific, but it comes before location ~
^/images/:

location ~ “^(/images/)(\d{1})/(\d{2})/(.*.jpg$)” {
}

Posted at Nginx Forum:

there is one before that:
location ~ “^(/images/)(\d{1})/(\d{2})/(.*.jpg$)” {

}

Posted at Nginx Forum:

Hello!

On Wed, Jun 19, 2013 at 05:28:51AM -0400, angelochen960 wrote:

there is another one, but more specific, but it comes before location ~
^/images/:

location ~ “^(/images/)(\d{1})/(\d{2})/(.*.jpg$)” {
}

There is no such thing as “more specific” when you are talking
about regular expressions. First match wins. See here for
details:

http://nginx.org/r/location


Maxim D.
http://nginx.org/en/donation.html

On Wed, Jun 19, 2013 at 05:28:51AM -0400, angelochen960 wrote:

Hi there,

there is another one, but more specific, but it comes before location ~
^/images/:

location ~ “^(/images/)(\d{1})/(\d{2})/(.*.jpg$)” {
}

If the only two “location” blocks in your server are:

location ~ “^(/images/)(\d{1})/(\d{2})/(.*.jpg$)” {
location ~ ^/images/ {

then the request for /images/sample.jpg will be handled in the second
one.

Which is not what you reported seeing.

f

Francis D. [email protected]

You are right, thanks to Francis too for giving me the right direction
to
look for the problem, it’s really the other location that should have
the
expires set as well, thanks.

Posted at Nginx Forum:

Read news update here daily. We introduce new gadgets.
Event Planning.

Posted at Nginx Forum: