On Sun, 2011-08-07 at 14:35 +0200, Eric Lemoine wrote:
> >    <VirtualHost *:80>
> >      ServerName www.example.com
> >      RewriteEngine On
> >      RewriteRule ^/(.*) http://appserver:6543/$1 [L,P]
> >      ProxyPreserveHost on
> >    </VirtualHost>
> >
> > The above configuration will pass the request off to
> > http://appserver:6543 with the SCRIPT_NAME+PATH_INFO that came in to
> > Apache ($1).  But the Host header will be the original Host header,
> so
> > that when a URL is generated, it will use the host of the proxy
> instead
> > of "appserver", which is exactly what you want.
> 
> Sure. I was referring to name-based virtual hosts, where Apache
> determines the virtual host based on the Host header.

It doesn't really matter if it's a name-based virtualhost or not.  The
same logic applies whether there's one VirtualHost or a hundred, and
whether they're name-based or IP-based.

> > On the other hand, if the above configuration disincludes the
> > ProxyPreserveHost On setting, any fully-qualified generated URL will
> be
> > wrong.
> >
> > This doesn't just include URLs generated by Pyramid APIs like
> route_url,
> > static_url, and resource_url.  It also includes URLs generated by
> WebOb
> > (request.application_url, request.url, etc) and any URLs generated
> by
> > middleware that depends on HTTP_HOST.
> 
> Right. I'd rather apply this: "don't generate fully-qualified URLs in
> your web apps, or you may have trouble running them behind proxies".

You're eventually going to run into situations with middleware that
unconditionally generates fully qualified URLs where I believe you're
going to need to modify that to "always set ProxyPreserveHost On".  But
until then, you can try to ignore it by generating only paths, although
I don't think that makes much sense given that it's so easy to turn on.

> > If, as you've suggested, your solution will be to develop an
> application
> > with host-and-port-free URLs rather than to proxy the Host header,
> is it
> > really worth talking about?
> 
> 
> I was just trying to fully understand why you think ProxyPreserveHost
> always made sense.

See above.


> Thank you for the discussion.

Sure, apologies if I sound dismissive, I just hate having long
discussions about defaults.

- C


-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to