Absolute rather than relative times in expires directives

Igor Sysoev igor at sysoev.ru
Sun Aug 1 19:55:14 MSD 2010


On Sun, Aug 01, 2010 at 09:57:16AM -0500, Ryan Malayter wrote:

> On Sun, Aug 1, 2010 at 6:39 AM, Mark James <mrj at advancedcontrols.com.au> wrote:
> > On 08/01/10 19:51, Denis F. Latypoff wrote:
> >>
> >> 01.08.2010, 13:23, "Mark James"<mrj at advancedcontrols.com.au>:
> >>>
> >>> I have a static HTML page that is updated at midnight each day. So I'd
> >>> like to set its expires directive to an absolute
> >>> rather than a relative time.
> >>
> >> Yes:
> >>     expires @23h59m;
> >
> > Thanks Denis!
> >
> > That form of the expires directive wasn't in the English documentation at
> > http://wiki.nginx.org/NginxHttpHeadersModule .
> >
> > I've re-written the English documentation for the expires directive as best
> > I could, which included adding the "@" and "modified" forms that were only
> > in the Russian doc.
> >
> 
> It's not in the English or Russian documentation, but is it possible
> to add any other Cache-Control directives along with expires?
> 
> For example, if you want "Cache-Control: private,max-age=300" you need
> to do it manually with add_header instead of expires. But then you
> lose the ability to use the other "calculation" features of expires
> (like modified or @). You also don't get an actual "Expires" header
> for HTTP/1.0 clients and proxies if you have to use add_header
> instead.
> 
> Obviously, adding any RFC-compliant Cache-Control directive would be
> desirable. The "public" keyword in particular is needed to allow
> Firefox to cache images and the like which are delivered over SSL, and
> "private" is clearly desirable for caching per-user information.
> Others like "must-revalidate" are less useful in the general sense.
> 
> If this isn't possible with the current implementation, please let me
> know and I will take a look at trying to make a simple patch (my first
> foray into nginx source instructed me that my C skills are way too
> rusty for deep modification or module-writing with nginx).

These directives

expires     @24h00m;
add_header  Cache-Control  private;

return

Expires: Sun, 01 Aug 2010 20:00:00 GMT
Cache-Control: max-age=14809
Cache-Control: private


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list