Class TransparentProxyInitializer

java.lang.Object
org.mockserver.netty.proxy.TransparentProxyInitializer

public class TransparentProxyInitializer extends Object
Utility for transparent HTTP proxy mode — provides Host-header parsing helpers and an isEnabled() configuration check.

Production path: The actual original-destination resolution and channel attribute setup is performed by TransparentProxyHandler, which fires on channelActive and writes the REMOTE_SOCKET attribute consumed by the forward path. This class provides supplementary Host-header parsing utilities.

  • Constructor Details

  • Method Details

    • isEnabled

      public boolean isEnabled()
    • resolveTargetHost

      public String resolveTargetHost(String hostHeader)
      Returns the forwarding host for a transparent proxy request. In transparent proxy mode, the Host header is the target.
      Parameters:
      hostHeader - the Host header value from the incoming request
      Returns:
      the target hostname, or null if the header is empty
    • resolveTargetPort

      public int resolveTargetPort(String hostHeader, boolean secure)
      Returns the forwarding port for a transparent proxy request.
      Parameters:
      hostHeader - the Host header value from the incoming request
      secure - whether the connection is TLS
      Returns:
      the target port