I'm using varnish 3. I switched it to req.http.host and simplified the regex to just "internal.my.com" and it worked perfectly. Thank you!
-Ryan On Nov 3, 2015, 2:08 AM -0500, Viktor Villafuerte<[email protected]>, wrote: > Hi Ryan, > > you're mixing req.url with req.http.host > > Also be aware of changes between Varnish 3 and 4. You didn't specified > which version you're using so I won't go into details. Those can be > found here > https://www.varnish-cache.org/docs/4.0/whats-new/upgrading.html > > > On Mon 02 Nov 2015 22:22:10, Ryan Morgan wrote: > > I have multiple subdomains pointing to one varnish instance. I read in the > > documentation that PCRE regex should be used. I believe the regex I have > > below should return true when the request url is > > “http://internal.my.com/any/thing<http://internal.my.com/any/thing>” and > > the 15s ttl should be set. I’ve tried just (req.url ~ > > “internal.my.com<http://internal.my.com/>”) as well because I read that it > > should match if any part of the request url. Help is appreciated! Thanks! > > > > -Ryan > > > > # Cache for a longer time if the internal.my.com URL isn't used > > sub vcl_fetch { > > if (req.url ~ "^[(http:\/\/)|(https:\/\/)]*internal\.my\.com.*"){ > > what you're matching here is req.http.host and so the statement never > returns true because it never matches > > Also I don't like the way the regex looks. I have not tested this so > quite possibly it works but it's bit ugly. I'm sure simpler and cleaner > regex could/should be found. > > > v > > > > set beresp.ttl = 15 s; > > } else { > > set beresp.ttl = 300 s; > > } > > } > > > _______________________________________________ > > varnish-misc mailing list > > [email protected] > > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc > > > -- > Regards > > Viktor Villafuerte > Optus Internet Engineering > t: +61 2 80825265
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
