varnish - Regex to match host request -


given vcl code in varnish 3.0.2:

sub vcl_recv {   if (req.http.host !~ "^(?i)(www|m|mobile)\.example\.com$" || req.http.host !~ "^(?i)example\.com$") {     error 403 "forbidden";   }   return(lookup); } 

can explain why i'm getting 403s on "www.example.com"?

thanks

i don't know varnish , syntax, interpret || logical or. www.example.com not match second alternative ==> true , enter if.

probably wanted logical and? if both not true, 403?

so try:

if (req.http.host !~ "^(?i)(www|m|mobile)\.example\.com$" && req.http.host !~ "^(?i)example\.com$") {     error 403 "forbidden";   } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -