public class HostHeaderCustomizer extends Object implements HttpConfiguration.Customizer
Host header (for example, HTTP 1.0 requests).
In case of HTTP 1.0 requests that lack the Host header, the application may issue
a redirect, and the Location header is usually constructed from the Host
header; if the Host header is missing, the server may query the connector for its
IP address in order to construct the Location header, and thus leak to clients
internal IP addresses.
This HttpConfiguration.Customizer is configured with a serverName and
optionally a serverPort.
If the Host header is absent, the configured serverName will be set on
the request so that ServletRequest.getServerName() will return that value,
and likewise for serverPort and ServletRequest.getServerPort().
| Constructor and Description |
|---|
HostHeaderCustomizer(String serverName) |
HostHeaderCustomizer(String serverName,
int serverPort) |
| Modifier and Type | Method and Description |
|---|---|
void |
customize(Connector connector,
HttpConfiguration channelConfig,
Request request) |
public HostHeaderCustomizer(String serverName)
serverName - the serverName to set on the request (the serverPort will not be set)public HostHeaderCustomizer(String serverName, int serverPort)
serverName - the serverName to set on the requestserverPort - the serverPort to set on the requestpublic void customize(Connector connector, HttpConfiguration channelConfig, Request request)
customize in interface HttpConfiguration.CustomizerCopyright © 1995–2017 Webtide. All rights reserved.