IBM Support

Why should I add extra host aliases in WAS virtualhost group (default_host)?

Question & Answer


Question

In a typical system that uses WebSphere Application Server (WAS), usually there are front-end services as well, such as a load balancer or webserver.  In such request flows, for example, client > load balancer (port 443) > webserver (port 8443) > webserver plugin > WAS (port 9443), why should I add a host alias of "*:443", and sometimes "*:8443", in WAS virtualhost group (default_host)? 

Cause

When a client request for a servlet, JavaServer Pages file, or related resource is received, the DNS alias is compared to the list of all known virtual host groups to locate the correct virtual host, and the URI is compared to the list of all known URI groups to locate the correct URI group. If a matching virtual host group or URI group is not found, an error is returned to the browser.
If a client connects to WAS directly without any intermediate service, then by default, WAS getVirtualPort() returns the server port, over which a request is received. However, if there is a webserver in between, for example, client > IHS webserver > webserver plugin > WAS, plugin will by default retrieve the port value from the Host header and then save the port in plugin private header $WSSP. When WAS detects $WSSP header is present, WAS will call getProxiedServerPort() to get port from $WSSP header instead.
image-20240409131357-1

Answer

The webserver plugin, or any other proxy that could modify the $WSSP header, changes how WAS gets the port from an incoming request. As a result, depending on the actual request flow, extra host aliases in the WAS virtualhost group (default_host) may be required.  Otherwise, if WAS cannot find a matching virtualhost, the request will fail, usually with SRVE0255E in the WAS SystemOut.log, and a 404 error will be returned to the client.
However, the behavior of how WAS and the webserver plugin gets ports is configurable, either from server port on the request that is received, or from the Host header. Read more in the following links.
From WAS end (com.ibm.ws.webcontainer.extractHostHeaderPort and trusthostheaderport): 
From webserver plugin end (AppServerPortPreference):

[{"Type":"MASTER","Line of Business":{"code":"LOB67","label":"IT Automation \u0026 App Modernization"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"ARM Category":[{"code":"a8m50000000CdN2AAK","label":"WebSphere Application Server traditional-All Platforms-\u003EWebContainer\/Servlet issues-\u003EHTTP 404 errors-\u003EVirtual Host errors"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]

Document Information

Modified date:
09 April 2024

UID

ibm17147759