0

i have the following situation: i need to call the following url http://myapp.mydomain.com

and the url should reply as following http://myapp.mydomain.com/index.jsp

On my apache 2.4 i tryied different setup but none seems to work,

First attempt

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass /myapp http://127.0.0.1:8080/myapp
    ProxyPassReverse /myapp http://127.0.0.1:8080/myapp
</VirtualHost>

Second attempt

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass /myapp/ http://127.0.0.1:8080/myapp/
    ProxyPassReverse /myapp/ http://127.0.0.1:8080/myapp/
</VirtualHost>

Third attempt

    <Location "/myapp/">
        ProxyPreserveHost On
        ProxyPass / http://127.0.0.1:8080/myapp/
        ProxyPassReverse / http://127.0.0.1:8080/myapp/
   </Location>

Fourth attempt

<Location "/myapp/">
    ProxyPreserveHost On
    ProxyPass /myapp/ http://127.0.0.1:8080/myapp/
    ProxyPassReverse /myapp/ http://127.0.0.1:8080/myapp/

None of the configuration seem to work, the url https://myapp.mydomain.com brings up the welcome page of the tomcat. And what ever configuration i apply to apache, the only way to make it work is to manually add on the link the mountpoint of proxy, as following

http://myapp:mydomain.com/myapp/index.jsp

Any suggestion on how can i make this work? Thanks in advance.

  • Add a `ServerName myapp.mydomain.com` inside the VirtualHost. Apache is not able to know that the vhost created is for that dns address. – João Alves Jun 05 '20 at 12:01

1 Answers1

0

Use below ProxyPass inside VirtualHost and test.

ProxyPass / http://127.0.0.1:8080/myapp/
ProxyPassReverse / http://127.0.0.1:8080/myapp/
Pandurang
  • 111
  • 1
  • 4