# Max-age=0 from Proxy only

**URL:** <https://www.ruby-forum.com/t/max-age-0-from-proxy-only/219607>\
**Category:** NGINX\
**Created:** [May 8, 2012, 11:07pm UTC](https://www.ruby-forum.com/t/max-age-0-from-proxy-only/219607 "2012-05-08T23:07:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [May 8, 2012, 11:07pm UTC](https://www.ruby-forum.com/t/max-age-0-from-proxy-only/219607/1 "2012-05-08T23:07:33Z")

</div>

Hello All,

What is the best way to cache a file from an origin to a proxy server  
(nginx) with a long max-age then change the max-age to 0 when the file  
is  
being downloaded from the Proxy.

If that is confusing hopefully this illustration will explain it better:  
[http://i.imgur.com/BakMD.png](http://i.imgur.com/BakMD.png)

Thanks.

Regards,

Justin D. [http://www.twitter.com/jdorfman](http://www.twitter.com/jdorfman)

NetDNA [http://www.netdna.com](http://www.netdna.com)  
The Science of Acceleration

---

<div class="post-metadata">

**Author:** ![jmadtech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7cd45c/32.png) [@jmadtech](https://www.ruby-forum.com/u/jmadtech)\
**Post date:** [May 8, 2012, 11:18pm UTC](https://www.ruby-forum.com/t/max-age-0-from-proxy-only/219607/2 "2012-05-08T23:18:44Z")

</div>

On 09/05/2012 00:07, Justin D. wrote:

> Hello All,
> 
> What is the best way to cache a file from an origin to a proxy server  
> (nginx) with a long max-age then change the max-age to 0 when the file  
> is being downloaded from the Proxy.
> 
> If that is confusing hopefully this illustration will explain it better:  
> [http://i.imgur.com/BakMD.png](http://i.imgur.com/BakMD.png)  
> cache is not ment to be cached forever.  
> i think that you might can use an if statement that will make a  
> “location” decision by the source ip or some header.

in most of the proxies you can override the max-age by acls.

Eliezer

> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

–  
Eliezer C.

> **[דף הבית של אליעזר](https://www.ngtech.co.il/index/)**

IT consulting for Nonprofit organizations  
eliezer ngtech.co.il

---

<div class="post-metadata">

**Author:** ![jmadtech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7cd45c/32.png) [@jmadtech](https://www.ruby-forum.com/u/jmadtech)\
**Post date:** [May 8, 2012, 11:47pm UTC](https://www.ruby-forum.com/t/max-age-0-from-proxy-only/219607/3 "2012-05-08T23:47:22Z")

</div>

Setting s-maxage to a high value and while simultaneously fixing maxage  
to 0 should do the job. Read the specs [1] for details.

[1] [RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1](http://tools.ietf.org/html/rfc2616)
