skip to Main Content

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


  1. You can achieve this using apache httpd and tomcat by using the reverseProxy settings

    1. 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

    2. 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

    Login or Signup to reply.
  2. 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).

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search