Request Header (Host attribute) lost/Reset from WebSeal to Apache web server

1.6k Views Asked by At

URL (https://xyz.abc.com/cc) when load balancer see /cc it will forward request to WebSeal (Revers Proxy server).

WebSeal add/set (Header Host : xyz.abc.com) and forward request to Apache2 (web server). In web seal we have standard junction (/cc) which will process the request from LB.

When request comes to Apache2 it loosing HOST header value (xyz.abc.com) and reset it to Apache2 server name (xyzapacheweb1)

Now finally request pass from apache2 to Liferay Portal (6.2) and it showing URL (xyzapacheweb1) instead of (xyz.abc.com)

Liferay need HOST name when web server fronting so we have to hard code URL (in property file or in apache2)

We want to remove Hard-Code value and pass dynamic host name so we can use multiple URLs for individual applications.

Note : When we don't have WebSeal in picture it preserve the HOST name. i.e. Apache2 show actual domain name (xyz.abc.com)

Can you please help me to resolve this problem?

Let me know if you need more info.

2

There are 2 best solutions below

0
On BEST ANSWER

I came up with two solutions.

  1. Temporary :

    • Set custom header attribute in request from WebSeal i.e. domain-host-name. From LB -> WebSeal set the host value to this variable.
    • Apache web server is able to retrieve this value because it's not default request header. Based on the domain-host-name value Set Header HOST value from Apache webserver for Liferay.
    • remove web.server.host.name property in Liferay it will automatically get the HOST value (which was set by Apache).

      Set xyz.abc.com if domain-host-name is set to xyz.abc.com

      SetEnvIf domain-host xyz.abc.com HAVE_MyRequestHeader RequestHeader set Host xyz.abc.com env=HAVE_MyRequestHeader

      Set abc.xyz.com if domain-host-name is set to abc.xyz.com

      SetEnvIf domain-host abc.xyz.com HAVE_MyRequestHeader_1 RequestHeader set Host abc.xyz.com env=HAVE_MyRequestHeader_1

This is a temporary solution because here we have to hardcode host name check in Apache. So if there is new URL then you have to configure it in Apache.

  1. Permanent :

    • WebSeal has Virtual Junction concept. Where webseal can be configure to play virtual hosting role.

Please refer : http://www-01.ibm.com/support/knowledgecenter/SSPREK_6.1.1/com.ibm.itame.doc_6.1.1/am611_webseal_admin642.htm%23vhost-scenario1?lang=en

Let me know if you are facing similar type issue I can help to resolve it.

2
On

If you're using mod_proxy to forward from apache to tomcat you're missing the option

ProxyPreserveHost On

This is because of forwarding through http. If you're using ajp this is automatically taken care of for you by the protocol.

I'm not sure of the equivalent option for webseal though, maybe the apache one helps you to find it