Caching for Error Pages
Sometimes clients will notice that their error pages are being cached. Say one of their files was missing from the origin, and they re-uploaded it, but CDN is still returning their 404 page until the cache is fully purged. The reason behind this is that the 404 page happened to have a Cache Control Header. In the example below, a 404 page with a CCH which will be cached.
$ curl -I http://foobar.example.com/myimages/some_random_image.png HTTP/1.1 404 Not Found Server: nginx/1.0.11 Date: Thu, 26 Jan 2012 20:01:36 GMT Content-Type: text/html;charset=utf-8 Connection: keep-alive Cache-Control: public, max-age=24383317 Expires: Tue, 06 Dec 2012 17:33:42 GMT Last-Modified: Sat, 01 Jan 2000 00:00:00 GMT Content-Length: 1051
These bolded headers should not exist with error pages, otherwise NginX will cache the error page as if it is a valid page.
Please make sure to unset/remove all headers on your 404/Error pages. Or if not possible, set a no-cache header as explained below, and as explained in this article.
ExpiresDefault A0 Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0" Header set Pragma "no-cache"
Support