Search code examples
javaproxywebsphere-libertyapplication-servercontextroot

How to append context root in IBM HTTP Proxy for Liberty Server


I have a Java EAR application deployed to a couple of liberty 16.x application servers, and have one IBM HTTP Proxy server (Apache) running in front of it acting as the load balancer and HTTPS proxy. I want to have our intranet users simply enter in an easy to remember URL like https://product-aa and then be redirected to https://server-aa:8443/EarApplication, without needing to have them manually add the context root in the URL.

I'm trying to figure out the best way to achieve this.


Solution

  • First, register product-aa in DNS as a CNAME for server-aa

    Then append to httpd.conf:

    NameVirtualHost *:80
    <virtualhost *:80>
      ServerName server-aa
    </virtualhost>
    <virtualhost *:80>
      ServerName product-aa
      RedirectMatch ^/$ /EarApplication
      # ... or http://server-aa/EarApplication
    </virtualhost>