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 HttpServletRequest#getServerName()
will return that value,
and likewise for serverPort
and HttpServletRequest#getServerPort()
.Constructor and Description |
---|
HostHeaderCustomizer(String serverName) |
HostHeaderCustomizer(String serverName,
int serverPort) |
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.Customizer
Copyright © 1995-2015 Webtide. All Rights Reserved.