# Cache 404 & 500 pages

**URL:** <https://www.ruby-forum.com/t/cache-404-500-pages/215767>\
**Category:** NGINX\
**Created:** [January 15, 2012, 7:58am UTC](https://www.ruby-forum.com/t/cache-404-500-pages/215767 "2012-01-15T07:58:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 15, 2012, 7:58am UTC](https://www.ruby-forum.com/t/cache-404-500-pages/215767/1 "2012-01-15T07:58:43Z")

</div>

Hi all,

When I attempt caching these pages as shown below

```
    error_page 404 /404.html;

    location = /404.html {

                root /var/www/prod /templates/;

                internal;

                add_header Cache-Control public;

                add_header X-Cache-Status $upstream_cache_status;

                proxy_cache generalcache;

                proxy_cache_key backend$request_uri;

                proxy_cache_use_stale updating;

    }

```

I don’t see the X-Cache-Status header in the html response. Does that  
mean  
the page does not get cached?

-Quintin

---

<div class="post-metadata">

**Author:** ![Quintin\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/13edae/32.png) [@Quintin\_P](https://www.ruby-forum.com/u/Quintin_P)\
**Post date:** [January 15, 2012, 12:12pm UTC](https://www.ruby-forum.com/t/cache-404-500-pages/215767/2 "2012-01-15T12:12:59Z")

</div>

Hello!

On Sun, Jan 15, 2012 at 12:27:41PM +0530, Quintin P. wrote:

> ```
> internal;
> 
> }
> 
> ```
> 
> I don’t see the X-Cache-Status header in the html response. Does that mean  
> the page does not get cached?

The “proxy\_cache” directive works if you are using proxy\_pass. It  
doesn’t work if you are serving static files as in the config  
above. This is expected behaviour.

Maxim D.
