<p dir="ltr">I think you want to return (hash) from vcl_hash and lookup from vcl_recv...</p>
<div class="gmail_quote">On 07/04/2015 7:30 am, "Hugo Cisneiros (Eitch)" <<a href="mailto:hugo.cisneiros@gmail.com">hugo.cisneiros@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Mon, Apr 6, 2015 at 6:19 PM, Jennings III, Raymond<br>
<<a href="mailto:raymond.jennings@nytimes.com">raymond.jennings@nytimes.com</a>> wrote:<br>
> What about doing something like renaming that header so that the default vcl<br>
> subroutine won't see it? Or maybe just always return from your sub-routine<br>
> so that the default vcl never runs.<br>
<br>
Hi!<br>
<br>
I did that and it didn't work :(<br>
<br>
What I tried:<br>
<br>
sub vcl_recv {<br>
[...]<br>
set req.http.X-Authorization = req.http.Authorization;<br>
unset req.http.Authorization;<br>
[...]<br>
return (hash);<br>
}<br>
<br>
sub vcl_hash {<br>
[...]<br>
hash_data(req.http.X-Authorization);<br>
[...]<br>
return (lookup)<br>
}<br>
<br>
sub vcl_backend_fetch {<br>
set bereq.http.Authorization = bereq.http.X-Authorization;<br>
}<br>
<br>
I think varnish4 do the validation on between backend fetch and<br>
response, and decides that it won't store the reply on the cache since<br>
the backend request contained the Authorization header... Since it<br>
never stores on the cache, I'll always get a miss no matter what I do<br>
with the request o vcl_recv.<br>
<br>
> I use a couple of techniques like what you are describing - where I add GET<br>
> params on the URL based on a particular header value as well as the inverse<br>
> (take GET parameters off of the URL so that they are not hashed) and stick<br>
> those values into a "X-" type header.<br>
><br>
> Maybe you can describe your technique in V3 so that we can see how we might<br>
> do the same in V4. I'm not an expert on V4 but I have reworked some of the<br>
> techniques that I have been using in V3 to V4 successfully.<br>
<br>
In V3 I really didn't need to do anything unusual. Just a simple<br>
caching VCL and it's working:<br>
<br>
sub vcl_recv {<br>
[...]<br>
unset req.http.cookie;<br>
return (lookup);<br>
}<br>
<br>
sub vcl_fetch {<br>
[...]<br>
set beresp.ttl = 1m;<br>
return (deliver);<br>
}<br>
<br>
Thanks,<br>
<br>
--<br>
[]'s<br>
Hugo<br>
<a href="http://www.devin.com.br" target="_blank">www.devin.com.br</a><br>
<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>