Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Varnish: Misc

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

 

 

Varnish misc RSS feed   Index | Next | Previous | View Threaded


openbsdnow at gmail

Feb 1, 2012, 4:01 PM

Post #1 of 6 (229 views)
Permalink
varnish/apache wacky incorrect port issues when link contains a trailing slash

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,

www.example.com/folder

becomes

www.example.com/folder/

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

www.example.com/folder become

www.example.com:8080/folder/

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,
Kevin
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.

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


r at roze

Feb 6, 2012, 1:32 AM

Post #2 of 6 (164 views)
Permalink
Re: varnish/apache wacky incorrect port issues when link contains atrailing slash [In reply to]

> 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?


Try adding:

UseCanonicalName Off

( http://httpd.apache.org/docs/current/mod/core.html#usecanonicalname ) in
your apache config then it should use whatever port/hostname varnish
(client) provides in the redirects rather than the defined in server block.

rr


_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


openbsdnow at gmail

Feb 7, 2012, 12:46 PM

Post #3 of 6 (161 views)
Permalink
Re: varnish/apache wacky incorrect port issues when link contains atrailing slash [In reply to]

Reinis Rozitis wrote:
>> 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?
> Try adding:
>
> UseCanonicalName Off
>
> ( http://httpd.apache.org/docs/current/mod/core.html#usecanonicalname
> ) in your apache config then it should use whatever port/hostname
> varnish (client) provides in the redirects rather than the defined in
> server block.
No dice.

Tried setting it globally first and for fun at the VirtualHost level,
too, with the same results, :8080 in any of our URLs when the
trailing / is omitted.

As much as I hate to say it, this is a show-stopper for me right now
with getting Varnish in play in our environment.

Anyone have any other ideas?

Many thanks,
Kevin

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


apj at mutt

Feb 7, 2012, 12:51 PM

Post #4 of 6 (162 views)
Permalink
Re: varnish/apache wacky incorrect port issues when link contains atrailing slash [In reply to]

On Tue, Feb 07, 2012 at 12:46:25PM -0800, Kevin wrote:
>
> Tried setting it globally first and for fun at the VirtualHost
> level, too, with the same results, :8080 in any of our URLs when
> the trailing / is omitted.
>
> As much as I hate to say it, this is a show-stopper for me right now
> with getting Varnish in play in our environment.
>
> Anyone have any other ideas?

Run apache on port 80. We usually bind apache to 127.0.0.1:80 where backend and
varnish runs on the same machine.

--
Andreas

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


footplus at gmail

Feb 7, 2012, 12:55 PM

Post #5 of 6 (161 views)
Permalink
Re: varnish/apache wacky incorrect port issues when link contains atrailing slash [In reply to]

On Tue, Feb 7, 2012 at 9:51 PM, Andreas Plesner Jacobsen <apj [at] mutt>wrote:

> On Tue, Feb 07, 2012 at 12:46:25PM -0800, Kevin wrote:
> >
> > Tried setting it globally first and for fun at the VirtualHost
> > level, too, with the same results, :8080 in any of our URLs when
> > the trailing / is omitted.
> >
> > As much as I hate to say it, this is a show-stopper for me right now
> > with getting Varnish in play in our environment.
> >
> > Anyone have any other ideas?
>
> Run apache on port 80. We usually bind apache to 127.0.0.1:80 where
> backend and
> varnish runs on the same machine.
>
>
That, and/or perhaps look at the description of the option
UseCanonicalPhysicalPort (
http://httpd.apache.org/docs/current/mod/core.html#usecanonicalphysicalport)
to be clear about the rewriting of Apache port number. Also, please
make
sure that the redirection was not cached by Varnish.

Best regards,
--
Aurélien Guillaume
*- By all means break the rules, and break them beautifully, deliberately
and well. That is one of the ends for which they exist. -- *Robert
Bringhurst


openbsdnow at gmail

Feb 7, 2012, 1:09 PM

Post #6 of 6 (164 views)
Permalink
Re: varnish/apache wacky incorrect port issues when link contains atrailing slash [In reply to]

Aurélien wrote:
> On Tue, Feb 7, 2012 at 9:51 PM, Andreas Plesner Jacobsen <apj [at] mutt
> <mailto:apj [at] mutt>> wrote:
>
> On Tue, Feb 07, 2012 at 12:46:25PM -0800, Kevin wrote:
> >
> > Tried setting it globally first and for fun at the VirtualHost
> > level, too, with the same results, :8080 in any of our URLs when
> > the trailing / is omitted.
> >
> > As much as I hate to say it, this is a show-stopper for me right now
> > with getting Varnish in play in our environment.
> >
> > Anyone have any other ideas?
>
> Run apache on port 80. We usually bind apache to 127.0.0.1:80
> <http://127.0.0.1:80> where backend and
> varnish runs on the same machine.
>
>
> That, and/or perhaps look at the description of the option
> UseCanonicalPhysicalPort (
> http://httpd.apache.org/docs/current/mod/core.html#usecanonicalphysicalport
> ) to be clear about the rewriting of Apache port number.
For better or worse, we're still using Apache 1.3, and this isn't/wasn't
an option in 1.3 (I already looked). :-(
> Also, please make sure that the redirection was not cached by Varnish.
I'm killing the daemon and restarting it each time I test. As far as I
know, this completely kills the cache, right? Or is there something else
I need to be doing, too?

_______________________________________________
varnish-misc mailing list
varnish-misc [at] varnish-cache
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Varnish misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.