Package org.eclipse.jetty.server
Class HostHeaderCustomizer
- java.lang.Object
-
- org.eclipse.jetty.server.HostHeaderCustomizer
-
- All Implemented Interfaces:
HttpConfiguration.Customizer
public class HostHeaderCustomizer extends java.lang.Object implements HttpConfiguration.Customizer
Customizes requests that lack theHost
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 theLocation
header is usually constructed from theHost
header; if theHost
header is missing, the server may query the connector for its IP address in order to construct theLocation
header, and thus leak to clients internal IP addresses.This
HttpConfiguration.Customizer
is configured with aserverName
and optionally aserverPort
. If theHost
header is absent, the configuredserverName
will be set on the request so thatServletRequest.getServerName()
will return that value, and likewise forserverPort
andServletRequest.getServerPort()
.
-
-
Constructor Summary
Constructors Constructor Description HostHeaderCustomizer(java.lang.String serverName)
HostHeaderCustomizer(java.lang.String serverName, int serverPort)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
customize(Connector connector, HttpConfiguration channelConfig, Request request)
-
-
-
Constructor Detail
-
HostHeaderCustomizer
public HostHeaderCustomizer(java.lang.String serverName)
- Parameters:
serverName
- theserverName
to set on the request (theserverPort
will not be set)
-
HostHeaderCustomizer
public HostHeaderCustomizer(java.lang.String serverName, int serverPort)
- Parameters:
serverName
- theserverName
to set on the requestserverPort
- theserverPort
to set on the request
-
-
Method Detail
-
customize
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
- Specified by:
customize
in interfaceHttpConfiguration.Customizer
-
-