Interface HttpProxyServerBootstrap

All Known Implementing Classes:
DefaultHttpProxyServer.DefaultHttpProxyServerBootstrap

public interface HttpProxyServerBootstrap
Configures and starts an HttpProxyServer. The HttpProxyServer is built using start(). Sensible defaults are available for all parameters such that start() could be called immediately if you wish.
  • Method Details

    • withName

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

      Default = LittleProxy

    • withTransportProtocol

      HttpProxyServerBootstrap withTransportProtocol(TransportProtocol transportProtocol)

      Specify the TransportProtocol to use for incoming connections.

      Default = TCP

    • withAddress

      Listen for incoming connections on the given address.

      Default = [bound ip]:8080

    • 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

    • withListenOnAllAddresses

      @Deprecated HttpProxyServerBootstrap withListenOnAllAddresses(boolean listenOnAllAddresses)
      Deprecated.
      use withNetworkInterface(InetSocketAddress) to avoid listening on all local addresses
      This method has no effect and will be removed in a future release.
    • withSslEngineSource

      HttpProxyServerBootstrap withSslEngineSource(SslEngineSource sslEngineSource)

      Specify an SslEngineSource to use for encrypting inbound connections. Enabling this will enable SSL client authentication by default (see withAuthenticateSslClients(boolean))

      Default = null

      Note - This and withManInTheMiddle(MitmManager) are mutually exclusive.

    • withAuthenticateSslClients

      HttpProxyServerBootstrap withAuthenticateSslClients(boolean authenticateSslClients)

      Specify whether or not to authenticate inbound SSL clients (only applies if withSslEngineSource(SslEngineSource) has been set).

      Default = true

    • withProxyAuthenticator

      HttpProxyServerBootstrap withProxyAuthenticator(ProxyAuthenticator proxyAuthenticator)

      Specify a ProxyAuthenticator to use for doing basic HTTP authentication of clients.

      Default = null

    • withChainProxyManager

      HttpProxyServerBootstrap withChainProxyManager(ChainedProxyManager chainProxyManager)

      Specify a ChainedProxyManager to use for chaining requests to another proxy.

      Default = null

    • withManInTheMiddle

      HttpProxyServerBootstrap withManInTheMiddle(MitmManager mitmManager)

      Specify an MitmManager to use for making this proxy act as an SSL man in the middle

      Default = null

      Note - This and withSslEngineSource(SslEngineSource) are mutually exclusive.

    • withFiltersSource

      HttpProxyServerBootstrap withFiltersSource(HttpFiltersSource filtersSource)

      Specify a HttpFiltersSource to use for filtering requests and/or responses through this proxy.

      Default = null

    • 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

    • withServerResolver

      HttpProxyServerBootstrap withServerResolver(HostResolver serverResolver)
      Specify a custom HostResolver for resolving server addresses.
    • withServerGroup

      HttpProxyServerBootstrap withServerGroup(ServerGroup group)
      Specify a custom ServerGroup to use for managing this server's resources and such. If one isn't provided, a default one will be created using the ThreadPoolConfiguration provided
      Parameters:
      group - A custom server group
    • plusActivityTracker

      HttpProxyServerBootstrap plusActivityTracker(ActivityTracker activityTracker)

      Add an ActivityTracker for tracking activity in this proxy.

    • 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
    • withMaxInitialLineLength

      HttpProxyServerBootstrap withMaxInitialLineLength(int maxInitialLineLength)
    • withMaxHeaderSize

      HttpProxyServerBootstrap withMaxHeaderSize(int maxHeaderSize)
    • withMaxChunkSize

      HttpProxyServerBootstrap withMaxChunkSize(int maxChunkSize)
    • 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

      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