Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

send reason along with backend request

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


arjen at thenextweb

Dec 11, 2011, 10:59 AM

Post #1 of 5 (333 views)
Permalink
send reason along with backend request

HI All,

Is there a way to send an extra header to the backend request if a miss occurs?
There are 4 scenario's I can think off: purged, old, not set and lru. This would make debugging and stats a lot easier.


Thanks,
Arjen




_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


straightflush at gmail

Dec 11, 2011, 5:47 PM

Post #2 of 5 (323 views)
Permalink
Re: send reason along with backend request [In reply to]

you should be able to add a req.http.header in your vcl_fetch. I dont
believe vcl_fetch gets called unless you are in a cache_miss and you need
to contact the backend.

sub vcl_fetch {

req.http.X-Custom-Header = "test";
}

Not sure varnish exposes the miss "reason" though, aside from the fact that
it is either not cacheable or it is and just isn't in the cache.



On Sun, Dec 11, 2011 at 1:59 PM, Arjen Schat <arjen [at] thenextweb> wrote:

> HI All,
>
> Is there a way to send an extra header to the backend request if a miss
> occurs?
> There are 4 scenario's I can think off: purged, old, not set and lru. This
> would make debugging and stats a lot easier.
>
>
> Thanks,
> Arjen
>
>
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>


hugo.cisneiros at gmail

Dec 14, 2011, 4:46 AM

Post #3 of 5 (315 views)
Permalink
Re: send reason along with backend request [In reply to]

On Sun, Dec 11, 2011 at 11:47 PM, AD <straightflush [at] gmail> wrote:
> you should be able to add a req.http.header in your vcl_fetch.  I dont
> believe vcl_fetch gets called unless you are in a cache_miss and you need to
> contact the backend.

In vcl_fetch varnish already contacted the backend and fetched the
answer. This is why beresp.* variable is already there. You can add
headers before the backend request on vcl_miss or vcl_hit (in your
case, vcl_miss).

--
[]'s
Hugo
www.devin.com.br

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


arjen at thenextweb

Dec 14, 2011, 6:08 AM

Post #4 of 5 (335 views)
Permalink
Re: send reason along with backend request [In reply to]

Yep, that is too late in the process.

Is the reason for the call to vcl_miss exposed? This would allow vcl_miss to set an extra bereq. Or is there a way to see which stats counters are updated by lookup?

Thank you,
Arjen

On 14 dec. 2011, at 13:46, Hugo Cisneiros (Eitch) wrote:

> On Sun, Dec 11, 2011 at 11:47 PM, AD <straightflush [at] gmail> wrote:
>> you should be able to add a req.http.header in your vcl_fetch. I dont
>> believe vcl_fetch gets called unless you are in a cache_miss and you need to
>> contact the backend.
>
> In vcl_fetch varnish already contacted the backend and fetched the
> answer. This is why beresp.* variable is already there. You can add
> headers before the backend request on vcl_miss or vcl_hit (in your
> case, vcl_miss).
>
> --
> []'s
> Hugo
> www.devin.com.br
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc [at] varnish-cache
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


hugo.cisneiros at gmail

Dec 14, 2011, 6:23 AM

Post #5 of 5 (317 views)
Permalink
Re: send reason along with backend request [In reply to]

On Wed, Dec 14, 2011 at 12:08 PM, Arjen Schat <arjen [at] thenextweb> wrote:
> Yep, that is too late in the process.
>
> Is the reason for the call to vcl_miss exposed? This would allow vcl_miss to set an extra bereq. Or is there a way to see which stats counters are updated by lookup?

I didn't quite understand the question, but vcl_miss is always called
when a lookup was made on an object and it wasn't in the cache (or the
object's ttl is expired in the cache). I think that was the original
question.

So in vcl_miss, you can define your headers using the bereq. variable,
for example:

set bereq.http.X-Radical-Header = "value"

And they will be send after vcl_miss returns (fetch).

--
[]'s
Hugo
www.devin.com.br

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.