views:

59

answers:

0

Hi! I have two subdomains:

test.domain.com prod.domain.com

I have one server with to urls (two apps): localhost:8080/app1/ localhost:8090/app2/

The two subdomains are redirected to the server i got.

Using Apache, how do i ProxyPassReverse so that this can happen:

If test.domain.com -> localhost:8080/app1/ If prod.domain.com -> localhost:8090/app2/

I have already tested this by editing the httpd-vhosts.conf in the Apache config:

<VirtualHost *:80>
  ServerName test.domain.com
  ServerAlias test.domain.com
  ProxyRequests Off
  ProxyPreserveHost On

  <Proxy *>
  Order deny,allow
  Allow from all
  </Proxy>

  ProxyPass / http://127.0.0.1:8080/app1/
  ProxyPassReverse / http://127.0.0.1:8080/app1/
</VirtualHost>

<VirtualHost *:80>
 ServerName prod.domain.com
 ServerAlias prod.domain.com
 ProxyRequests Off
 ProxyPreserveHost On

 <Proxy *>
   Order deny,allow
   Allow from all
 </Proxy>

 ProxyPass / http://127.0.0.1:8090/app2/
 ProxyPassReverse / http://127.0.0.1:8090/app2/

What happens if i go to: test.domain.com -> i am transferred to http://127.0.0.1:8080/app1/ CORRECT prod.domain.com -> i am transferred to http://127.0.0.1:8080/app1/ WRONG

Does anybody have an idea of what i am doing wrong?

Thanks in advance.