0

I have a spring web application running in tomcat which I can access using https://example:8080/myApp. I have installed Apache2 to redirect port 443 requests to tomcat. now I can Access my application without the port number. I have installed SSL certificate using LetsEncrypt and all HTTP requests are forwarded to https. when I enter my domain in the browser, it is taking me to tomcat home, not to my web app. This is my virtual host config for 443

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        JKMount /* ajp13_worker
        ProxyPreserveHost On
        ProxyRequests Off
        ServerAdamin webmaster@myDomain
        ServerName example.com
        ServerAlias www.example.com
        ProxyPass https://example.com http://localhost:8080/myApp
        ProxyPassReverse https://example.com http://localhost:8080/myApp
        <!--ssl details-->
    </VirtualHost>
</IfModule>

Why it is not redirecting to myApp. Any help will be appreciated. Please ask if you need more details.

Sony
  • 103
  • 1
  • 6

1 Answers1

1

When using two arguments on ProxyPass it does not take a full URL as the first argument, only the path.

ProxyPass / http://localhost:8080/myApp/
ProxyPassReverse / http://localhost:8080/myApp/

The trailing slash is also important.

Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79