0

This is the code I've added to the vcl file, so that it caches content for desktop users and mobile users separately:

if (req.http.User-Agent ~ "(iPhone|Android|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nitro|Nokia|Opera Mini|Palm|PlayStation Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows CE|WinWAP|YahooSeeker/M1A1-R2D2|PalmSource)") {
    set req.http.Host = "m.wwwery.com";
}

But when I see here (http://www.ephur.net/2010/01/04/improving-wordpress-performance-and-supporting-wptouch-with-varnish/), it's like "Opera\ Mini". why so?

Should I be adding a "\" whenever there's a space? or I don't have to do that? Please advise.

womble
  • 95,029
  • 29
  • 173
  • 228

1 Answers1

0

I see no reason to have to quote spaces in the varnish config. It's already double quoted and a space isn't a special character in a regex. Further, the examples in https://www.varnish-cache.org/trac/wiki/VCLExampleNormalizeUserAgent don't quote spaces. I think the example you cited is broken.

womble
  • 95,029
  • 29
  • 173
  • 228
  • So precisely, I need not place a "\" for occurrences of space. Right? Is "\" what you meant by quote? Also, by broken example, you meant this: http://www.ephur.net/2010/01/04/improving-wordpress-performance-and-supporting-wptouch-with-varnish/ correct? –  Jul 05 '11 at 00:50
  • Yes, "\" in this case is the quoting character. The example you cited is, indeed, the ephur.net blog post. – womble Jul 05 '11 at 01:00