I have 2 applications running on JBoss with an Apache server in-front.

The applications are currently being proxied by Apache:

ProxyPass /App1 http://mydomain.com:8080/App1
ProxyPassReverse /App1 http://mydomain.com:8080/App1
ProxyPass /App2 http://mydomain.com:8080/App1
ProxyPassReverse /App1 http://mydomain.com:8080/App1

I have 2 sub-domains:

 app1.mydomain.com
 app2.mydomain.com

So I can now access my apps with:

 http://app1.mydomain.com/App1
 http://app2.mydomain.com/App2

How can I configure Apache so that I can serve these apps from:

 http://app1.mydomain.com
 http://app1.mydomain.com

Is it possible to do this with a mod_rewrite rule?

Thanks!

link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

The way to do this 'correctly' is to set up a couple of vhosts in your apache config like so:

NameVirtualHost *:80 #only if this is not present earlier in httpd.conf

<VirtualHost *:80>
    ServerName: app1.mydomain.com
    ProxyPass http://mydomain.com:8080/App1
    ProxyPassReverse http://mydomain.com:8080/App1
</VirtualHost>

<VirtualHost *:80>
    ServerName: app2.mydomain.com
    ProxyPass http://mydomain.com:8080/App2
    ProxyPassReverse http://mydomain.com:8080/App2
</VirtualHost>
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.