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;
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.
On Sun, Aug 01, 2010 at 09:57:16AM -0500, Ryan M. wrote:
š š expires @23h59m;
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).
Hmm… multiple Cache-Control header lines appear to be valid
according to RFC 2616, but my fear would be that many popular browsers
and caches would not behave sensibly with them.
Is anybody out there using multiple Cache-Control header lines for a
public site in production?
I did some research looking at the HTTP headers used by the “major”
web companies (Google, MSFT, Yahoo, etc.). I haven’t ever seen
multiple Cache-Control header lines in a response, which makes me
think that such a scenario is probably not well-supported by common
browsers and proxies. In my past experience, Firefox treats just about
anything except “public”,“private”, or “max-age” as “no-cache”. IE8
seems to do the same, which I suppose is a safe default behavior if
you don’t want to fully implement all the logic necessary to support
all the allowable header combinations in the RFC.
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).
I did double check the nginx version I am having and it is 1.9.2.
root@ser2:~# nginx -V
nginx version: nginx/1.9.2
built by gcc 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configure arguments:
–add-module=/tmp/nginx/ngx_http_substitutions_filter_module-master
–add-module=/tmp/nginx/headers-more-nginx-module-0.26
–add-module=/tmp/nginx/ngx_pagespeed-release-1.9.32.3-beta
–sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx.conf
root@ser2:~#
but when I use the expires directive it shows invalid error same as
before.
Seems like to get the feature I need to update the nginx version.
but when I use the expires directive it shows invalid error same as before.
This likely means that nginx you are checking for “nginx -V” is
not the same as one that really works. This may happen if you
have more than one nginx binary (e.g., one in /usr/, and another
one in /usr/local), or you haven’t restarted/upgraded running
nginx binary after upgrading nginx on disk, see here: