Problem, Question
Following setup: IHS Webserver with Dispatcher module configured which in turn points to a Websphere app-server render farm where a CQ instance is running. A class or jsp script in CQ calls the response.sendRedirect()
method which results in a wrong redirect: the internal server name and port of the Websphere app-server which is not reachible from the outside is exposed in the Location
response header which is used to do the actual redirect.
The root cause of this problem is Websphere itself as IBM's implementation of the HttpServletResponse#sendRedirect()
method is directly influenced by custom request headers, per default generated by Websphere's IHS plugin. This is considered as an IBM vendor lock-in issue.
Resolution, Answer
Using mod_headers
in the IHS webserver it is possible to pass Websphere specific headers to the app-server by adding such headers with the RequestHeader
directive. In addition to that, these custom headers need to be explicitely allowed in the Dispatcher configuration, otherwise these custom headers will be ignored.
Example:
- public domain: http://www.mydomain.com
IHS configuration
Edit the httpd.conf
configuration file of the IHS webserver and do the following:
- make sure that the module
mod_headers
is present and loaded - add WAS specific headers using
RequestHeader
directive
Example (excerpt from httpd.conf
):
... LoadModule headers_module modules/mod_headers.so ... <Directory /> <IfModule disp_apache2.c> # set custom Websphere headers RequestHeader set $WSSN www.mydomain.com RequestHeader set $WSSP 80 SetHandler dispatcher-handler </IfModule> Options FollowSymLinks </Directory>
Dispatcher configuration
On Dispatcher level, it is required to add the list of above configured request headers to the list of client headers that the Dispatcher will forward to the defined render farm, Websphere app-server in this case.
Please do the following:
- edit the
dispatcher.any
configuration file - locate the section
/clientheaders
and add additional headers to be included - restart IHS
Example (excerpt from dispatcher.any
):
... /clientheaders { ... "$WSSN" "$WSSP" } ...
Websphere configuration
The $WSSP
Websphere header specifies the port and $WSSN
defines the hostname to be used when response.sendRedirect()
is called in Websphere. In addition to that, the port provided in the $WSSP
header is also used to map the virtual host in Websphere.
Connect to the Administration Console of Websphere and do the following:
- browse to
Environment > Virtual Hosts
- select the virtual host configuration which is used for CQ
- click on
Host Aliases
- add port
80
- restart Websphere if required
NOTE: it might be required to add more Websphere specific headers, depending on the setup. Please refer to this document describing Websphere specific headers and their meaning.
下載