Welcome! Log In Create A New Profile

Advanced

how to add Cache-Control: public to static files

Jauder Ho
October 05, 2009 10:20PM
Hi, I have nginx set up to serve static content and to set it to maximum
expires currently. However, I would also like to set the Cache-Control
flag to public so that proxies will know that this is okay to cache.
However, when I try this using the add_header directive, this adds an
additional Cache-Control: header instead of modifying the existing one.

nginx config fragment:
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires max;
add_header Cache-Control public;
}


what I get using curl:
HTTP/1.1 200 OK
Date: Tue, 06 Oct 2009 02:12:27 GMT
Content-Type: image/gif
Content-Length: 96
Last-Modified: Thu, 17 Sep 2009 01:51:06 GMT
Connection: close
Vary: Accept-Encoding
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Cache-Control: public
Accept-Ranges: bytes
--
Posted via http://www.ruby-forum.com/.
Subject Author Posted

how to add Cache-Control: public to static files

Jauder Ho October 05, 2009 10:20PM

Re: how to add Cache-Control: public to static files

Chris Zimmerman October 05, 2009 10:44PM

Re: how to add Cache-Control: public to static files

Igor Sysoev October 06, 2009 04:10AM

Re: how to add Cache-Control: public to static files

Maxim Dounin October 06, 2009 03:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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