You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by John Cheng <jo...@gmail.com> on 2010/12/22 20:13:40 UTC

ATS to return cached contents on 500 error

Can ATS be configured (as a forward proxy) to return cached contents
when the origin server returns an error?

This may be an unusual use case, and I'll describe the scenario I
think where it might be needed. I want to use ATS as a forward proxy
between our application servers and external web services. This allows
us to reduce the number of web services calls and use local caching to
increase performance. In this case, one of our external partners has a
flaky web service system. The contents of their web service does not
change often and is suitable for caching the contents daily. However,
some times, their web service will return a 404 or 500 for a whole
day, then go back to normal the next day. So the behavior I'd like is
for our system to check to origin server for any changes. If there is
a change, update the local cache. If there is an error (404, 500), or
time out then continue to use the cached content.

I looked into the configuration file and it does not appear ATS
supports this kind of behavior. I am wondering if this is possible
with ATS.

-- 
---
John L Cheng

Re: ATS to return cached contents on 500 error

Posted by John Cheng <jo...@gmail.com>.
Thank you for the tip!

On Wed, Dec 22, 2010 at 2:38 PM, Leif Hedstrom <zw...@apache.org> wrote:
> On 12/22/2010 12:13 PM, John Cheng wrote:
>>
>> Can ATS be configured (as a forward proxy) to return cached contents
>> when the origin server returns an error?
>
> I think you are referring to what Squid calls "Stale While Error". There's
> currently no way to do this afaik, Yahoo has a plugin for it, which I'm not
> sure they will open source or not. Since it's been done before, it could
> certainly be done again, someone just needs to implement it :).
>
>
> -- Leif
>
>



-- 
---
John L Cheng

Re: ATS to return cached contents on 500 error

Posted by Leif Hedstrom <zw...@apache.org>.
On 12/22/2010 12:13 PM, John Cheng wrote:
> Can ATS be configured (as a forward proxy) to return cached contents
> when the origin server returns an error?

I think you are referring to what Squid calls "Stale While Error". 
There's currently no way to do this afaik, Yahoo has a plugin for it, 
which I'm not sure they will open source or not. Since it's been done 
before, it could certainly be done again, someone just needs to 
implement it :).


-- Leif


Re: ATS to return cached contents on 500 error

Posted by Glen Campbell <gl...@rackspace.com>.
The stale-if-error directive should cause that behavior, but I'm not
certain if it's been implemented in ATS yet (online documentation refers
to "future versions").

You could certainly write a custom extension to do that if you don't want
to rely upon the client headers.

http://www.mnot.net/blog/2007/12/12/stale

On 12/22/10 1:13 PM, "John Cheng" <jo...@gmail.com> wrote:

>Can ATS be configured (as a forward proxy) to return cached contents
>when the origin server returns an error?
>
>This may be an unusual use case, and I'll describe the scenario I
>think where it might be needed. I want to use ATS as a forward proxy
>between our application servers and external web services. This allows
>us to reduce the number of web services calls and use local caching to
>increase performance. In this case, one of our external partners has a
>flaky web service system. The contents of their web service does not
>change often and is suitable for caching the contents daily. However,
>some times, their web service will return a 404 or 500 for a whole
>day, then go back to normal the next day. So the behavior I'd like is
>for our system to check to origin server for any changes. If there is
>a change, update the local cache. If there is an error (404, 500), or
>time out then continue to use the cached content.
>
>I looked into the configuration file and it does not appear ATS
>supports this kind of behavior. I am wondering if this is possible
>with ATS.
>
>-- 
>---
>John L Cheng



Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message.
Your cooperation is appreciated.