Package org.eclipse.jetty.server
Class HostHeaderCustomizer
java.lang.Object
org.eclipse.jetty.server.HostHeaderCustomizer
- All Implemented Interfaces:
HttpConfiguration.Customizer
Customizes requests that lack the
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().
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHostHeaderCustomizer(String serverName) HostHeaderCustomizer(String serverName, int serverPort) -
Method Summary
Modifier and TypeMethodDescriptionvoidcustomize(Connector connector, HttpConfiguration channelConfig, Request request)
-
Field Details
-
serverName
-
serverPort
private final int serverPort
-
-
Constructor Details
-
HostHeaderCustomizer
- Parameters:
serverName- theserverNameto set on the request (theserverPortwill not be set)
-
HostHeaderCustomizer
- Parameters:
serverName- theserverNameto set on the requestserverPort- theserverPortto set on the request
-
-
Method Details
-
customize
- Specified by:
customizein interfaceHttpConfiguration.Customizer
-