Fixing backend URLs

Michael Alger varnish at mm.quex.org
Fri Sep 24 07:12:35 CEST 2010


On Fri, Sep 24, 2010 at 11:48:16AM +0700, Dang Tung wrote:
> Thanks for fast reply,
> 
> but I pasted wrong, actually when I remove these block, it doesn't work
> 
> sub vcl_fetch {
>  if (beresp.status == 301 || beresp.status == 302)
>  {
>    set beresp.http.Location = regsub(beresp.http.Location, "^(\w+://[^/]+):\d+", "\1");
>  }
> }

Hmm. Can you provide the headers of one of the URLs you're testing, with
as little anonymisation as possible? e.g. using

  wget -S -O /dev/null http://www.example.com/

Is it possible that your test URL is already cached by Varnish?
vcl_fetch() is only called when the resource was fetched from the
backend, so if it was already cached by Varnish that code will never be
called. Either purge the URL or add similar code in vcl_hit().




More information about the varnish-misc mailing list