Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc
Varnish as Redirection Server
 

Index | Next | Previous | View Flat


kelvin1111111 at gmail

Apr 10, 2012, 3:36 AM


Views: 411
Permalink
Varnish as Redirection Server

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);
}
}
=========================================

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Subject User Time
Varnish as Redirection Server kelvin1111111 at gmail Apr 10, 2012, 3:36 AM
    Re: Varnish as Redirection Server contact at jpluscplusm Apr 10, 2012, 3:43 AM
    Re: Varnish as Redirection Server kelvin1111111 at gmail Apr 10, 2012, 3:53 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.