Class HostHeaderCustomizer

  • All Implemented Interfaces:
    HttpConfiguration.Customizer

    public class HostHeaderCustomizer
    extends java.lang.Object
    implements 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().

    • Constructor Detail

      • HostHeaderCustomizer

        public HostHeaderCustomizer​(java.lang.String serverName)
        Parameters:
        serverName - the serverName to set on the request (the serverPort will not be set)
      • HostHeaderCustomizer

        public HostHeaderCustomizer​(java.lang.String serverName,
                                    int serverPort)
        Parameters:
        serverName - the serverName to set on the request
        serverPort - the serverPort to set on the request