# Proxy\_cache - how to change expires?

**URL:** <https://www.ruby-forum.com/t/proxy-cache-how-to-change-expires/188522>\
**Category:** NGINX\
**Created:** [May 13, 2010, 9:52am UTC](https://www.ruby-forum.com/t/proxy-cache-how-to-change-expires/188522 "2010-05-13T09:52:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CSSSSdric\_Jeanneret](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@CSSSSdric\_Jeanneret](https://www.ruby-forum.com/u/CSSSSdric_Jeanneret)\
**Post date:** [May 13, 2010, 9:52am UTC](https://www.ruby-forum.com/t/proxy-cache-how-to-change-expires/188522/1 "2010-05-13T09:52:35Z")

</div>

Hello!

I’m using nginx as a proxy-cache for OSM tiles. My problem is this  
sentence in documentation :  
“”“The cache honors backend’s Cache-Control, Expires, and etc since  
version 0.7.48"”"[1]

I saw that we’re supposed to be able to override some headers, like  
“expires” with proxy\_ignore\_headers[2], but it doesn’t seem to work.

OSM has an expires set to 3 hours. I’d like to keep tiles for 5 days, so  
I have:  
proxy\_ignore\_client\_abort on;  
proxy\_ignore\_headers “Expires” “X-Accel-Expires”;  
proxy\_cache\_valid 200 302 7d;  
proxy\_cache\_valid 404 1m;

But it seems my cache is really reseted each 3 hours (for now there  
isn’t many traffic on this vhost, it’s just a proof of concept for a  
client).

Did I miss something in the documentation ? if so, what ?  
Maybe I don’t use the right configuration, too. Any hints ?

Thank you !

Best regards,

C.

[1] [Module ngx\_http\_proxy\_module](http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache)  
[2] [Module ngx\_http\_proxy\_module](http://wiki.nginx.org/NginxHttpProxyModule#proxy_ignore_headers)

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_Jeanneret](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@CSSSSdric\_Jeanneret](https://www.ruby-forum.com/u/CSSSSdric_Jeanneret)\
**Post date:** [May 13, 2010, 12:21pm UTC](https://www.ruby-forum.com/t/proxy-cache-how-to-change-expires/188522/2 "2010-05-13T12:21:49Z")

</div>

Hello!

On Thu, May 13, 2010 at 09:51:37AM +0200, CÃ©dric Jeanneret wrote:

> proxy\_ignore\_headers “Expires” “X-Accel-Expires”;  
> proxy\_cache\_valid 200 302 7d;  
> proxy\_cache\_valid 404 1m;
> 
> But it seems my cache is really reseted each 3 hours (for now there  
> isn’t many traffic on this vhost, it’s just a proof of concept for a  
> client).
> 
> Did I miss something in the documentation ? if so, what ?  
> Maybe I don’t use the right configuration, too. Any hints ?

Expires may be set via Cache-Control as well (max-age=). You have  
to ignore it too.

Maxim D.

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_Jeanneret](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@CSSSSdric\_Jeanneret](https://www.ruby-forum.com/u/CSSSSdric_Jeanneret)\
**Post date:** [May 13, 2010, 12:25pm UTC](https://www.ruby-forum.com/t/proxy-cache-how-to-change-expires/188522/3 "2010-05-13T12:25:20Z")

</div>

On Thu, May 13, 2010 at 09:51:37AM +0200, Cédric Jeanneret wrote:

> OSM has an expires set to 3 hours. I’d like to keep tiles for 5 days, so I have:  
> Maybe I don’t use the right configuration, too. Any hints ?  
> nginx sets an expiration time at the moment when a response is cached.  
> If you did not ignore the headers some time ago, previously cached  
> responses will be valid for 3 hours only. New responses should be  
> cached for 7 days.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**

---

<div class="post-metadata">

**Author:** ![CSSSSdric\_Jeanneret](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@CSSSSdric\_Jeanneret](https://www.ruby-forum.com/u/CSSSSdric_Jeanneret)\
**Post date:** [May 13, 2010, 7:13pm UTC](https://www.ruby-forum.com/t/proxy-cache-how-to-change-expires/188522/4 "2010-05-13T19:13:25Z")

</div>

On Thu, May 13, 2010 at 12:24 PM, Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > “expires” with proxy\_ignore\_headers[2], but it doesn’t seem to work.
> 
> Igor S.  
> [Igor Sysoev](http://sysoev.ru/en/)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://nginx.org/mailman/listinfo/nginx)

Oh, thank you for the Cache-Control hint. I just added it, I’ll see  
what happens from now.

Thank you for the quick answer.

See you!

C.
