nginx not returning 304 on cached content

Posted by Don H on Server Fault See other posts from Server Fault or by Don H
Published on 2012-10-29T12:03:36Z Indexed on 2012/11/03 23:04 UTC
Read the original article Hit count: 207

Filed under:
|
|

I'm using nginx as a reverse proxy with an Apache back-end handling some PHP files.

The files return the right expiry headers and proxy_cache does a good job of caching them, but I've noticed that the cached content returns a 200 on every refresh, when it might be more efficient to return a 304 on the cached files.

The files in question are generated by PHP. The urls do not have .php in them as they've been prettified.

Any idea why nginx might not be returning 304 on repeated visits to a cached PHP output?

To clarify: It's using proxy_cache for caching dynamic PHP pages (not static html pages generated by PHP). I'm setting expires headers in the PHP file of time + 24 hours. With that in mind, I was hoping nginx would be able to then return 304s on its cached versions during that 24 hour window.

© Server Fault or respective owner

Related posts about nginx

Related posts about proxy