[TriLUG] I need help with Apache VirtualHost and proxy pass

Rick DeNatale rick at denhaven2.homeip.net
Sat Jul 17 18:29:10 EDT 2004


On Sat, 2004-07-17 at 03:34 -0400, Jon Carnes wrote:
> I would use something like RedirectMatch (or ReWrite)to do this.
>  RedirectMatch /special[/]*$ http://192.168.0.40:8080/ 

The problem wasn't doing the redirection, I'd tried doing this with
rewrite in the past, and things got all wrapped around the axle when the
client browser started asking for incorrectly named objects, the
ProxyPass and ProxyPassReverse directives seem to be the correct way to
actually do the forwarding.

The problem was controlling when things got forwarded. After more head
scratching, I ran:
# /usr/sbin/httpd -t -D DUMP_VHOSTS

and httpd complained:
[Sat Jul 17 17:53:41 2004] [error] VirtualHost _default_:443 -- mixing *
ports and non-* ports with a NameVirtualHost address is not supported,
proceeding with
undefined results
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:*                    is a NameVirtualHost
         default server new.host.name (/etc/httpd/conf.d/ssl.conf:90)
         port 443 namevhost new.host.name
(/etc/httpd/conf.d/ssl.conf:90)
         port * namevhost default (/etc/httpd/conf/httpd.conf:1062)
         port * namevhost special.denhaven2.homeip.net
(/etc/httpd/conf/httpd.conf:1069)
Syntax OK


The problem turned out to be a "sample" file
in /etc/httpd/conf.d/ssl.conf which was getting included early on in the
httpd.conf file and declaring a bogus ssl VirtualHost.  I renamed this
file since I'm not (yet?) supporting ssl and now things are working as I
wanted.

> On Fri, 2004-07-16 at 22:43, Rick DeNatale wrote:
> > I'm trying to set up Apache so that if someone tries to access a
> > particular host name it passes the request on to a program running on
> > the same machine which listens on port 8080 for http requests. Any other
> > host name should be processed on the normal port 80 by httpd itself.
> > 
> > In other words, special.denhaven2.homeip.net should serve up from the
> > port 8080 daemon, www.denhaven2.homeip.net, or foo.denhaven.homeip.net
> > etc. should get the "normal" pages.
> > 
> > I've been tearing my hair out trying to get this to work.  If I
> > explicitly ask for www.denhaven2.homeip.net I get my normal page, but if
> > I ask for anythingelse.denhaven2.homeip.net I get the results from the
> > daemon on port 8080. In other words, the default is wrong.
> > 
> > Here's what I think is the relevant section of
> > my /etc/httpd/conf/httpd.conf:
> > 
> > NameVirtualHost *
> > 
> > <VirtualHost *>
> >     ServerAdmin webmaster at denhaven2.homeip.net
> >     DocumentRoot /var/www/html
> >     ServerName www.denhaven2.homeip.net
> > </VirtualHost>
> > 
> > 
> > <VirtualHost special.local.denhaven2.homeip.net:80>
> > 	ServerAdmin webmaster at denhaven2.homeip.net
> > 	ServerName special.denhaven2.homeip.net
> > 	ServerAlias special
> > 	ProxyPass /error/ !
> > 	ProxyPass / http://192.168.0.40:8080/
> > 	ProxyPassReverse / http://192.168.0.40:8080/
> > 	<Location />
> > 	  Order deny,allow
> >           Allow from all
> >         </Location>
> > </VirtualHost>
> > 
> > 
> > ______________________________________________________________________
> > 
> > -- 
> > TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> > TriLUG Organizational FAQ  : http://trilug.org/faq/
> > TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> > TriLUG PGP Keyring         : http://trilug.org/~chrish/trilug.asc
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.trilug.org/pipermail/trilug/attachments/20040717/595685ae/attachment.pgp>


More information about the TriLUG mailing list