Strange problem with cache

florian.iragne nginx-forum at
Thu Oct 25 20:34:14 UTC 2012


i've come accross a strange problem of caching. My site is run by nginx
1.2.1, on two different servers. The config are exactly the same (i use
puppet to mirror configs). The contents are exactly the same, everything
that i can think of is exactly identical on both servers.

In the config, i set "expires max" for the /static location.

The two nginx are behind a haproxy instance for loadbalancing and failover.
The setup is in active-active mode.

When i load a page with no browser cache, each item in the static location
is served by nginx with the correct response regarding the max-age and
expire directives. Then i reload the page : some of these ressources are
served with a 304 response (that is the expected behaviour), some with a 200
code (hence, a fresh copy of the file). If i reload the page again and
again, the ressources served with 304 answer are varying.

Now, i've put the server into active-backup mode, and only one instance of
nginx is serving the files. In this setup, the ressources are always served
with a 304 answer.

Did i miss something? I assume that my servers setup is quite common, and i
d'ont believe that the behaviour i observe is "normal".

Any idea?



Posted at Nginx Forum:,232235,232235#msg-232235

More information about the nginx mailing list