apache - Varnish 4 rewrite URL transparently -
i looking after website running pretty standard varnish/apache set up. client needs add new domain transparently serves path/query string in order create lightweight version of site. example:
the user visits mobile.example.com points same server example.com
varnish rewrites mobile.example.com request example.com/mobile?theme=mobile
user receives page served example.com/mobile?theme=mobile apache, stays on mobile.example.com
we need hit both path , add query string here, maintain path user has entered, i.e: mobile.example.com/test should serve content @ example.com/mobile/test?theme=mobile
any tips doing varnish 4? possible?
got working!
if (req.http.host ~ "^mobile\.example\.com") { set req.http.host = "example.com"; set req.url = regsub(req.url, "^/", "/mobile/"); set req.url = regsub(req.url, "$", "?theme=mobile"); }
Comments
Post a Comment