Mailing List Archive

Setting a variable/header in vcl_recv and checking it in other sub routines
If I want to make some decision by checking some header(eg:
req.http.test) in vcl_backend_response being set in vcl_recv but not
sent as http header while fetching from backend or while sending
response to client, how should I do this?

Let's say, I want to store all the objects that is set to 'true' in
req.http.test header in vcl_recv and check it in vcl_backend_beresponse
to store that object in "test.storage". But, as I am unsetting the
header(bereq.http.test) in vcl_backend_fetch, it can't be used in
vcl_backend_response while setting storage hint.

Any suggestion?
Thanks in advance.


On Mon, Apr 9, 2018, 11:00 Md. Golam Hossain <mghhimu@gmail.com> wrote:

> If I want to make some decision by checking some header(eg:
> req.http.test) in vcl_backend_response being set in vcl_recv but not
> sent as http header while fetching from backend or while sending
> response to client, how should I do this?
>
> Let's say, I want to store all the objects that is set to 'true' in
> req.http.test header in vcl_recv and check it in vcl_backend_beresponse
> to store that object in "test.storage". But, as I am unsetting the
> header(bereq.http.test) in vcl_backend_fetch, it can't be used in
> vcl_backend_response while setting storage hint.
>
> Any suggestion?
> Thanks in advance.
>
>
Re: Setting a variable/header in vcl_recv and checking it in other sub routines [ In reply to ]
Hi,

Use vmod_var, from varnish-modules. You'll store variables without setting
headers.

--
Guillaume Quintard

On Mon, Apr 9, 2018 at 11:12 AM, Md. Golam Hossain <mghhimu@gmail.com>
wrote:

> If I want to make some decision by checking some header(eg:
> req.http.test) in vcl_backend_response being set in vcl_recv but not
> sent as http header while fetching from backend or while sending
> response to client, how should I do this?
>
> Let's say, I want to store all the objects that is set to 'true' in
> req.http.test header in vcl_recv and check it in vcl_backend_beresponse
> to store that object in "test.storage". But, as I am unsetting the
> header(bereq.http.test) in vcl_backend_fetch, it can't be used in
> vcl_backend_response while setting storage hint.
>
> Any suggestion?
> Thanks in advance.
>
>
> On Mon, Apr 9, 2018, 11:00 Md. Golam Hossain <mghhimu@gmail.com> wrote:
>
>> If I want to make some decision by checking some header(eg:
>> req.http.test) in vcl_backend_response being set in vcl_recv but not
>> sent as http header while fetching from backend or while sending
>> response to client, how should I do this?
>>
>> Let's say, I want to store all the objects that is set to 'true' in
>> req.http.test header in vcl_recv and check it in vcl_backend_beresponse
>> to store that object in "test.storage". But, as I am unsetting the
>> header(bereq.http.test) in vcl_backend_fetch, it can't be used in
>> vcl_backend_response while setting storage hint.
>>
>> Any suggestion?
>> Thanks in advance.
>>
>>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>