Setting headers for negative caching

bkirkbri nginx-forum at nginx.us
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:

[code]
location ^~ /x/ {
    error_page  404  /not_found.html;
}
location /not_found.html {
    internal;

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

But no luck.

Thanks in advance!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,103267,103267#msg-103267




More information about the nginx mailing list