Varnish as Redirection Server
Kelvin Loke
kelvin1111111 at gmail.com
Tue Apr 10 12:36:59 CEST 2012
I am using Varnish purely for redirection and cater for below scenario:
1. If http://www.abc.com/url1, redirect to http://www.abc.com/url2
2. If http://www.xyz.com/url1, redirect to http://www.xyz.com/url2
I tried to put the req.http.host variable inside, but Varnish has
error when restarting, I am wondering on how to actually input the
variable into error message?
=========================================
sub vcl_recv {
if (req.url ~ "/url1") {
error 750 "http://" req.http.host "/url2";
}
error 404 "NOT FOUND";
}
sub vcl_error {
if (obj.status == 750) {
set obj.http.Location = obj.response;
set obj.status = 301;
return(deliver);
}
}
=========================================
More information about the varnish-misc
mailing list