Varnish silently rewriting 301 redirect

Josef Fortier fortier at augsburg.edu
Wed Jun 29 17:33:37 CEST 2016


It looks like if varnish sees:

    * A backend issue a redirect one one hostname to another
    * And varnish manages that back end as well
    * And the IP address of both match
    * Then varnish will silently rewrite the backend redirect to the 
      original host address (which makes the redirect fail in our case)

I'm curious if anyone can help me understand this better. If possible 
I'd like to know how to tell varnish to not do this.

It's taken a chunk of yesterday to work this out. The trigger situation, 
I moved a URL shortener behind an existing varnish server. The existing 
setup has several IP addresses bound to it. If the redirector issued a 
301 for an address also served by another host on that same IP, the 
redirect domain was silently re-written to the original (redirector) 
hostname. But if the redirect come in on a different IP, the backend 
301 goes out unaltered.

I ended up using vcl_synth redirects to the underlying server (with 
regex mangling of the path) to bypass varnish. But I'd like to 
understand this better.

Thanks
-- 
__________________________________________________________________________
Josef Fortier
Systems Administrator
fortier at augsburg.edu
Phone: 612-330-1479
__________________________________________________________________________



More information about the varnish-misc mailing list