# Fastcgi-cache and expires

**URL:** <https://www.ruby-forum.com/t/fastcgi-cache-and-expires/227836>\
**Category:** NGINX\
**Created:** [March 30, 2013, 11:36am UTC](https://www.ruby-forum.com/t/fastcgi-cache-and-expires/227836 "2013-03-30T11:36:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [March 30, 2013, 11:36am UTC](https://www.ruby-forum.com/t/fastcgi-cache-and-expires/227836/1 "2013-03-30T11:36:47Z")

</div>

Just curious…

In a lot of examples I’ve seen on the net for setting up fastcgi-cache  
the  
directives

fastcgi\_ignore\_headers Cache-Control Expires;  
expires epoch;

are included. Is there any major reason for that? For my own setup I  
want  
the fastcgi caching to reduce load on the server, but I’d also like to  
perhaps fine tune the browser caching with expires headers for some  
pages.

Before I change it, is there any huge reason “fastcgi\_ignore\_headers  
Cache-Control Expires;” and “expires epoch;” should stay in my  
fastcgi-params file?

Thanks.

---

<div class="post-metadata">

**Author:** ![Ian\_MSEvans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7bcc69/32.png) [@Ian\_MSEvans](https://www.ruby-forum.com/u/Ian_MSEvans)\
**Post date:** [March 30, 2013, 12:00pm UTC](https://www.ruby-forum.com/t/fastcgi-cache-and-expires/227836/2 "2013-03-30T12:00:09Z")

</div>

> Before I change it, is there any huge reason “fastcgi\_ignore\_headers  
> Cache-Control Expires;” and “expires epoch;” should stay in my  
> fastcgi-params file?

nginx honours the headers the backend sends.

Often dynamic applications (like php when using sessions etc) send  
headers  
which “deny” any kind of caching ( Cache-Control: no-store, no-cache,  
must-revalidate, post-check=0, pre-check=0 and Expires header in the  
past)  
so to cache such responses nginx has to override theese headers.

In this case though without the context the ‘epires epoch;’ directive  
makes  
not a lot of sense (at least for me) since it sets the epire header to 1  
January, 1970 00:00:01 GMT meaning it shouldn’t be cached.

I always feel that setting the expire/cache headers in the application  
(unless imposible to change the code) is more flexible and allows to  
avoid  
errors (caching something for too long or wrong response) rather than  
overriding it in the proxy.

Also I wouldn’t put the expire/header directives in the fastcgi\_params  
file  
since that means you use those for every request versus putting in some  
specific location {} blocks.

rr
