I want to have an intranet site such that
There is a machine with static IP address: 192.168.88.80
Mapped via hosts file to domain: www.example.com
Then I want to map an address such that when I enter the following in browser address bar: http://app.example.com
It loads my Tomcat hosted application at http://www.example.com:8080/app but address bar still displays http://app.example.com
I have tried several combinations but not able to configure such. I keep getting http://www.example.com:8080/app in my browser bar.
Does anyone have any idea, preferably using Apache httpd
Thanks
2
Answers
You can achieve this using apache httpd and tomcat by using the reverseProxy settings
Uncomment the appropriate line in Apache’s httpd.conf file to enable the Apache mod_proxy and mod_proxy_http modules
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
add an Apache proxypass and an Apache proxypassreverse entry at the end of the httpd.conf file.
ProxyPass /sample http://localhost:8080/sample
ProxyPassReverse /sample http://localhost:8080/sample
See https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/How-to-configure-Apache-as-a-reverse-proxy-example for more details
The simplest way to address this, without any extra software is, is to run Tomcat on port 80, which will fix the 8080 part, and to rename your war file to ROOT.war, which address the context part (the
app
in the URL).