Yeah, Leif's config should definitely work :)

About the http.cache setting, I was under the same impression (that it was too 
late to set it at READ_RESPONSE hook) as Leif until recently, when I 
accidentally saw that the code actually checks that setting at the 
read_response hook as well (it may not have been necessarily intentional, but, 
it seems to give additional flexibility).

So, in theory, at least both configs should work as far as not caching it goes.

One potential problem with adding <Cache-Control: no-cache, no-store> as 
opposed to simply disabling the http.cache setting is that, one might need to 
restore the origin's Cache-Control setting again at SEND_RESPONSE_HDR_HOOK 
(depending on whether they care about what the clients see/do), else the client 
will see the "no-cache, no-store" as well.




On Thursday, April 7, 2016 2:46 PM, Steve Malenfant <smalenf...@gmail.com> 
wrote:



I use what Leif said and it works great. Our problem was origin sending
cache control and expire headers and negative response. Looks like the
negative caching param doesn't work as intended. I meant to send something
about it but could never get around testing it properly.


On Wednesday, April 6, 2016, Leif Hedstrom <zw...@apache.org> wrote:

>
> > On Apr 6, 2016, at 8:02 PM, Sudheer Vinukonda
> <sudhe...@yahoo-inc.com.INVALID> wrote:
> >
> > There's probably several ways of doing this (such as, disabling
> negative_caching etc), but, the most reliable way is to use header_rewrite
> to turn off http.cache on a non-200 response.
> >
> > Below's a sample config (I didn't test it myself, so, it may need some
> twiddling around):
> >
> > % cat plugin.config
> > header_rewrite.so negative_caching.config
> >
> >
> > % cat negative_caching.config
> >
> > cond %{READ_RESPONSE_HDR_HOOK} [AND]
> > cond %{STATUS} >=400
> > set-config proxy.config.http.cache.http 0 [L]
>
>
> Pretty sure that would not work, but try it. If it doesn’t work, then
> change it to something like
>
>         cond %{READ_RESPONSE_HDR_HOOK} [AND]
>         cond %{STATUS} >=400
>         set-header Cache-Control no-store,private
>
> or some such. I think turning off the cache at this stage is too late.
>
> — leif
>
>

Reply via email to