Varnish - Apache - Port 81 Trailing Slash Rewrite

Sam Davey sam at
Thu Nov 10 13:26:20 CET 2011


I'm running varnish-2.1.5 on port 80 with an apache backend on port 81.

I'm having a strange problem with my configuration.

Basically I have added a new folder called 'test' in my webroot so I
can access via  This directory only
contains a simple html file.

If I access the url with the trailing slash everything works fine.

However if I access the url without the trailing slash my page hangs
and eventually the address bar displays

It is hanging because I don't let port 81 through my firewall.

I do have some rewrite rules in apache but they pass through
RewriteCond %{REQUEST_FILENAME} !-d so they should not run.

As such I am confused.  What is causing it to try and rewrite or
redirect to

How can I configure it correctly? (BTW I am using Plesk 9.5.2 if that
makes a difference)

Obviously I could add the following to my vcl_recv

if ( ~ "^(www\.)?exampledomain\" && req.url~ "^/test") {
set req.url = req.url "/";

But that makes the content look like its coming from /test instead of
/test/ and as such in certain circumstances I could get a duplicate
content penalty.  Also I must be correct in thinking that this sort of
handling should take place in the backend, not in varnish.

Kind regards,

Music Matter is a trading style of Matter Retail Ltd, Unit A116 Tustin Way, Longridge Road, Preston, PR2 5LX, United Kingdom.

Registered in England & Wales, Company number 06920634.

This email and any files transmitted with it are confidential. If you have received this email in error please notify the sender and then delete it immediately. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Matter Retail Ltd. The recipient should check this email and any attachments for the presence of viruses. Matter Retail Ltd. accepts no liability for any damage caused by any virus transmitted by this email.

Save resources: Think before you print.

More information about the varnish-misc mailing list