Reputation: 4809
I'm looking to use varnish to rewrite the query param for this site and redirect the domain also
http://www.example.com/?s=SearchTerm ==> http://www.example2.com/search?q=SearchTerm
So far I've tried to get the first part ie. query params to rewrite using regsub ie.
sub vcl_recv {
if (req.http.host == "example.com") {
set req.http.url = regsub(
req.url,
"^/?s=.*",
"^/?search=.*"
);
set req.backend = www01;
return (pass);
}
}
however the original url doesn't change in the varnishlog - anyone see the issue?
Cheers
Upvotes: 1
Views: 1041
Reputation: 1698
I had same issue with obsolete code got from the web. You need to replace
set req.backend = www01;
by
set req.backend_hint = www01;
Upvotes: 1