I have battled with this particular for a while and am certainly doing a problem.
I've apache server along with a JBoss server on a single machine. Let me redirect traffic for mydomain.com to JBoss localhost:8080/example. The DNS is presently setup for mydomain.com and it'll go right to port 80 when joined in to the browser.
My real question is how do you redirect to another port whenever a certain domain title involves apache (within this situation, "mydomain.com")?
<VirtualHost ip.addr.is.here> ProxyPreserveHost On ProxyRequests Off ServerName mydomain.com ProxyPass http://mydomain.com http://localhost:8080/example ProxyPassReverse http://mydomain.com http://localhost:8080/example </VirtualHost>
Up-to-date w/ Suggestions - Still not sending to port 8080
<VirtualHost *:80> ProxyPreserveHost On ProxyRequests Off ServerName mydomain.com ServerAlias www.mydomain.com ProxyPass http://mydomain.com http://localhost:8080/example ProxyPassReverse http://mydomain.com http://localhost:8080/example </VirtualHost>
Without having to utilize a proxy to JBoss and mydomain.com:8080 could be "uncovered" around the world, i quickly would do that.
<VirtualHost *:80> ServerName mydomain.com Redirect 301 / http://mydomain.com:8080/ </VirtualHost>
Apache supports title based and IP based virtual hosts. It appears as if you are utilizing both, that is most likely not the thing you need.
I believe you are really trying to setup name-based virtual hosting, and for your you don't have to specify the Ip.
Try < VirtualHost *:80> to bind to any or all IP addresses, unless of course you want ip based virtual hosting. This might be when the server has several IP addresses, and you need to serve different sites on different addresses. The most typical setup is (I'd guess) title based virtual hosts.
You'll need 2 things:
- Give a
ServerAlias www.mydomain.comfor your config
- improve your proxypass to
ProxyPassMatch ^(.*)$ http://localhost:8080/example$1, to possibly keep mod_dir and trailing slashes from interferring.