varnish/apache wacky incorrect port issues when link contains a trailing slash

Kevin openbsdnow at
Thu Feb 2 01:01:00 CET 2012

Hi all,

In the process of testing varnish on our dev machine, I discovered many 
external links pointing to our site are missing the trailing slash. If 
the links were just on our site, I'd fix the links, and all would be 
fine, but I've recently discovered there are a lot of external links 
pointing to our site that are missing the trailing slash, so that 
solution isn't in the cards.

Normally, this isn't a problem since Apache gracefully handles the 
missing / and the visitor ends up with the / in the URL where needed. So,


Fine. Now varnish enters into the picture, and requests to become

8080, being the port I've moved Apache onto so Varnish can live on 80. 
I've tried a host of different mod_rewrite rules to try to get Apache to 
play nice, but so far, no dice.

So, I'm back to wondering:

1. if there's a way to handle this type of thing more gracefully in 
varnish (and if not)
2. does anyone have the mod_rewrite foo to exorcise my new-found 
trailing slash problem?

Many thanks,
P.S. This isn't as simple as opening up 8080 at the firewall, since 
requests then end up going to Apache rather than Varnish, so that does 
me no good.

More information about the varnish-misc mailing list