Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 = "";

But when I see here (, 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

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 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:… correct? – user88753 Jul 5 '11 at 0:50
Yes, "\" in this case is the quoting character. The example you cited is, indeed, the blog post. – womble Jul 5 '11 at 1:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.