Setting headers for negative caching

bkirkbri nginx-forum at
Mon Jun 28 20:54:13 MSD 2010

Is it possible to set Cache-Control / Expires headers for 404 responses
in Nginx?

I've tried using an error_page like this:

location ^~ /x/ {
    error_page  404  /not_found.html;
location /not_found.html {

    root /static/errordoc;
    expires 10m;
    add_header Cache-Control "private, max-age=600";

But no luck.

Thanks in advance!

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

More information about the nginx mailing list