Take the 2-minute tour ×

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.

share|improve this question
add comment

1 Answer

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.

share|improve this answer
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: ephur.net/2010/01/04/… correct? –  user88753 Jul 5 '11 at 0:50
Yes, "\" in this case is the quoting character. The example you cited is, indeed, the ephur.net blog post. –  womble Jul 5 '11 at 1:00
add comment

Your Answer

