if (req.restarts == 0) VCL Error

Tim Dunphy bluethundr at gmail.com
Wed May 7 17:17:11 CEST 2014


Oh interesting. I think I may have had a slight formatting issue. I've
tried copying the code into my VCL again and it ran fine. Sorry for the
false alarm. Hope I didn't waste anyone's time.

Thanks
Tim


On Wed, May 7, 2014 at 2:52 AM, Per Buer <perbu at varnish-software.com> wrote:

> Hi Tim.
>
>
> On Wed, May 7, 2014 at 4:27 AM, Tim Dunphy <bluethundr at gmail.com> wrote:
>
>> Hey All,
>>
>>  I'm trying to write a VCL subroutine. The purpose of the section I am
>> having a problem with is to set some headers when it encounters a restart
>> condition. Here's the code.
>>
>> sub vcl_recv {
>>     if (req.restarts == 0) {
>>       if (req.http.x-forwarded-for) {
>>            set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", "
>> + client.ip;
>>        } else {
>>        set req.http.X-Forwarded-For = client.ip;  }
>>     }
>>
>>     if (req.request != "GET"&&req.request != "HEAD") {
>>       return (pass);
>>     }
>>
>>     set req.backend = www;
>> }
>>
>
> FWIW, I took the above code, put it in a file, along with a backend named
> www and the code compiled and loaded just fine.
>
>
> --
>  <http://www.varnish-software.com/> *Per Buer*
> CTO | Varnish Software
> Phone: +47 958 39 117 | Skype: per.buer
> We Make Websites Fly!
>
> Winner of the Red Herring Top 100 Global Award 2013
>
>
>


-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140507/6b3aa244/attachment.html>


More information about the varnish-misc mailing list