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 5 at 12:01
0

Use below ProxyPass inside VirtualHost and test.

ProxyPass / http://127.0.0.1:8080/myapp/
ProxyPassReverse / http://127.0.0.1:8080/myapp/
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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