Multiple instances of varnish
Richard Chiswell
richard.chiswell at mangahigh.com
Fri May 6 18:39:11 CEST 2011
On 06/05/2011 17:27, Mike Franon wrote:
> Thanks that is even easier then what I was trying to do was bypass F5
>
> like this
>
> if (req.http.user-agent ~ "(.*bingbot.*|.*control.*|.*crawler.*)") {
> set req.backend = bots_81;
> }
>
>
> But was going to be a really long list. This will be easier to implement.
I've only just seen this, but we use:
set req.http.X-Varnish-Robots = "No";
if (req.http.user-agent ~
"(msnbot|Teoma|Googlebot|Gigabot|ia_archiver|Yahoo!
Slurp|ScoutJet|wabot)") {
set req.http.X-Varnish-Robots = "Yes : "
regsub(req.http.user-agent,"(msnbot|Teoma|Googlebot|Gigabot|ia_archiver|Yahoo!
Slurp|ScoutJet|wabot)","\2");
}
if (req.http.X-Varnish-Robots == "No") {
/**
* Do stuff we don't need to do for robots
*/
}
To identify robots to bypass Geolocation.
Hope it helps,
Richard Chiswell
>
>
> On Fri, May 6, 2011 at 3:54 AM, Hettwer, Marian<mhettwer at team.mobile.de> wrote:
>> On 05.05.11 19:00, "david raistrick"<drais at icantclick.org> wrote:
>>
>>> On Thu, 5 May 2011, Mike Franon wrote:
>>>
>>>> I am trying to see if there is a way with using a single instance
>>>>
>>>> 1) Varnish using VCL to recognize that it is a bot
>>>>
>>>> 2) If it is a bot request, varnish will then use a different backend.
>>> Sure. You don't need multiple varnishes for this.
>>>
>>> Define your backend, create a rule that matches on the headers you're
>>> matching on, set the backend.
>>>
>>> I don't have anything that matches on user agents (which is what I assume
>>> you're looking at on the F5), and I'm not going to look at the docs to
>>> find out how to match on them, but an example that does the same thing
>>> for
>>> URIs:
>> If the F5 is able to recognize a bot, let it just insert a custom http
>> header (X-F5-Found-Bot or something like that) and later match in vcl_recv
>> on this header.
>>
>> Pretty much like this:
>>
>> sub vcl_recv {
>> if (req.http.X-F5-Found-Bot) {
>> set req.backend = backendforbots;
>> }
>> }
>>
>>
>>
>> HTH,
>> Marian
>>
>>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
More information about the varnish-misc
mailing list