Strange problem with url redirecting when clicking on a link

Damien Sarazin damien.sarazin at smile.fr
Thu Aug 7 15:32:45 CEST 2008


Hi,

i finally succeeded in finding the origin of the problem and in 
reproducting it on a test website. It comes from rewriterules in the 
apache configuration.

First i noticed in firebug that the url with ":81" had a code  "301" but 
there was not the redirected url with code "200".

The rewriterules rules were written like this :

RewriteRule ^/test.html / [R=301,L]

For this rewriterule to work with Varnish you have to modify it like that :

RewriteRules ^/test.html http://www.website.com/ [R=301,L]

Else if you don't want to modify your Apache configuration, you can try 
to add this in your vcl file :

In sub vcl_fetch {
      
       if (obj.http.location ~ ":81"){
               set obj.http.location = regsub(obj.http.location,"\:81","");
        }
}

Best Regards,

Damien S.



More information about the varnish-misc mailing list