Welcome! Log In Create A New Profile

Advanced

Re: caching: Expires takes precedence over max-age

Maxim Dounin
August 02, 2013 08:02AM
Hello!

On Thu, Aug 01, 2013 at 03:59:45AM -0400, hippo wrote:

> Hello, I have a trouble with nginx caching pages it shouldn't cache. I have
> uwsgi_cache enabled:
>
> uwsgi_cache_path /tmp/cache levels=1:2 keys_zone=django:1m;
> location /test {
> uwsgi_pass unix:/tmp/uwsgi.sock;
> uwsgi_cache django;
> }
>
> nginx caches responses that have Expires header set in the future, even if
> Cache-Control says otherwise:
>
> Expires: Fri, 02 Aug 2013 19:47:42 GMT
> Cache-Control: no-cache, must-revalidate, max-age=0
>
> And rfc2616 says:
>
> Note: if a response includes a Cache-Control field with the max-
> age directive (see section 14.9.3), that directive overrides the
> Expires field.
>
> Happens on nginx 1.2.1 and 1.4.1. If I add "uwsgi_ignore_headers Expires;"
> to the nginx conf, the pages don't get cached. Is there something wrong with
> my nginx or uwsgi response headers?

As of now nginx treats both Expires and "Cache-Control: max-age"
with equal precedence, and uses whichever comes first.
X-Accel-Expires takes precedence over both of them.

--
Maxim Dounin
http://nginx.org/en/donation.html

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

caching: Expires takes precedence over max-age

hippo August 01, 2013 03:59AM

Re: caching: Expires takes precedence over max-age

Maxim Dounin August 02, 2013 08:02AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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