I'm setting up a Tomcat based application and would also like to remove the port number from the URL. I have successfully gotten Tomcat and the application installed and accessible directly via the port number, ie https://domainname.com:8443/appname. Following a number of guides I've enabled mod_proxy in Apache and added the following to my site configuration.
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /appname http://localhost:8444/appname
ProxyPassReverse /appname http://localhost:8444/appname
To test it I then reloaded Apache and for good measure restarted Tomcat. Going to https://domainname.com:8443/appname still works but https://domainname.com/appname gives me the Apache "Internal Server Error" page. I've tried the following in the site configuration to get this working.
- Replace http with https
- Replace localhost with domainname.com
I took a look at the Apache logs and found only a few relevant lines in each log file.
access.log
192.168.0.10 - - [09/Dec/2022:10:33:37 -0500] "GET /appname HTTP/1.1" 500 4945 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
192.168.0.10 - - [09/Dec/2022:10:33:57 -0500] "-" 408 4070 "-" "-"
error.log
[Fri Dec 09 10:33:37.102500 2022] [ssl:info] [pid 967896] [client 192.168.0.10:42724] AH01964: Connection to child 10 established (server domainname.com:443)
[Fri Dec 09 10:33:37.106941 2022] [ssl:info] [pid 966568] [client 192.168.0.10:42732] AH01964: Connection to child 29 established (server domainname.com:443)
[Fri Dec 09 10:33:57.138057 2022] [reqtimeout:info] [pid 966568] [client 192.168.0.10:42732] AH01382: Request header read timeout
Checking the Tomcat application logs shows no access attempt when the error is given.