Interface HttpProxyServerBootstrap

    • Method Detail

      • withName

        HttpProxyServerBootstrap withName​(String name)

        Give the server a name (used for naming threads, useful for logging).

        Default = LittleProxy

      • withPort

        HttpProxyServerBootstrap withPort​(int port)

        Listen for incoming connections on the given port.

        Default = 8080

      • withAllowLocalOnly

        HttpProxyServerBootstrap withAllowLocalOnly​(boolean allowLocalOnly)

        Specify whether or not to only allow local connections.

        Default = true

      • withUseDnsSec

        HttpProxyServerBootstrap withUseDnsSec​(boolean useDnsSec)

        Specify whether or not to use secure DNS lookups for outbound connections.

        Default = false

      • withTransparent

        HttpProxyServerBootstrap withTransparent​(boolean transparent)

        Specify whether or not to run this proxy as a transparent proxy.

        Default = false

      • withIdleConnectionTimeout

        HttpProxyServerBootstrap withIdleConnectionTimeout​(int idleConnectionTimeout)

        Specify the timeout after which to disconnect idle connections, in seconds.

        Default = 70

      • withConnectTimeout

        HttpProxyServerBootstrap withConnectTimeout​(int connectTimeout)

        Specify the timeout for connecting to the upstream server on a new connection, in milliseconds.

        Default = 40000

      • withThrottling

        HttpProxyServerBootstrap withThrottling​(long readThrottleBytesPerSecond,
                                                long writeThrottleBytesPerSecond)

        Specify the read and/or write bandwidth throttles for this proxy server. 0 indicates not throttling.

      • withNetworkInterface

        HttpProxyServerBootstrap withNetworkInterface​(InetSocketAddress inetSocketAddress)
        All outgoing-communication of the proxy-instance is going' to be routed via the given network-interface
        Parameters:
        inetSocketAddress - to be used for outgoing communication
      • withAllowRequestToOriginServer

        HttpProxyServerBootstrap withAllowRequestToOriginServer​(boolean allowRequestToOriginServer)
        When true, the proxy will accept requests that appear to be directed at an origin server (i.e. the URI in the HTTP request will contain an origin-form, rather than an absolute-form, as specified in RFC 7230, section 5.3). This is useful when the proxy is acting as a gateway/reverse proxy. Note: This feature should not be enabled when running as a forward proxy; doing so may cause an infinite loop if the client requests the URI of the proxy.
        Parameters:
        allowRequestToOriginServer - when true, the proxy will accept origin-form HTTP requests
      • withProxyAlias

        HttpProxyServerBootstrap withProxyAlias​(String alias)
        Sets the alias to use when adding Via headers to incoming and outgoing HTTP messages. The alias may be any pseudonym, or if not specified, defaults to the hostname of the local machine. See RFC 7230, section 5.7.1.
        Parameters:
        alias - the pseudonym to add to Via headers
      • start

        HttpProxyServer start()

        Build and starts the server.

        Returns:
        the newly built and started server
      • withThreadPoolConfiguration

        HttpProxyServerBootstrap withThreadPoolConfiguration​(ThreadPoolConfiguration configuration)
        Set the configuration parameters for the proxy's thread pools.
        Parameters:
        configuration - thread pool configuration
        Returns:
        proxy server bootstrap for chaining
      • withAcceptProxyProtocol

        HttpProxyServerBootstrap withAcceptProxyProtocol​(boolean allowProxyProtocol)
        Specifies if the proxy server should accept a proxy protocol header. Once set it works with request that include a proxy protocol header. The proxy server reads an incoming proxy protocol header from the client.
        Parameters:
        allowProxyProtocol - when true, the proxy will accept a proxy protocol header
      • withSendProxyProtocol

        HttpProxyServerBootstrap withSendProxyProtocol​(boolean sendProxyProtocol)
        Specifies if the proxy server should send a proxy protocol header.
        Parameters:
        sendProxyProtocol - when true, the proxy will send a proxy protocol header