Interface HttpProxyServerBootstrap
-
- All Known Implementing Classes:
DefaultHttpProxyServer.DefaultHttpProxyServerBootstrap
public interface HttpProxyServerBootstrapConfigures and starts anHttpProxyServer. The HttpProxyServer is built usingstart(). Sensible defaults are available for all parameters such thatstart()could be called immediately if you wish.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description HttpProxyServerBootstrapplusActivityTracker(ActivityTracker activityTracker)Add anActivityTrackerfor tracking activity in this proxy.HttpProxyServerstart()Build and starts the server.HttpProxyServerBootstrapwithAcceptProxyProtocol(boolean allowProxyProtocol)Specifies if the proxy server should accept a proxy protocol header.HttpProxyServerBootstrapwithAddress(InetSocketAddress address)Listen for incoming connections on the given address.HttpProxyServerBootstrapwithAllowLocalOnly(boolean allowLocalOnly)Specify whether or not to only allow local connections.HttpProxyServerBootstrapwithAllowRequestToOriginServer(boolean allowRequestToOriginServer)When true, the proxy will accept requests that appear to be directed at an origin server (i.e.HttpProxyServerBootstrapwithAuthenticateSslClients(boolean authenticateSslClients)Specify whether or not to authenticate inbound SSL clients (only applies ifwithSslEngineSource(SslEngineSource)has been set).HttpProxyServerBootstrapwithChainProxyManager(ChainedProxyManager chainProxyManager)Specify aChainedProxyManagerto use for chaining requests to another proxy.HttpProxyServerBootstrapwithConnectTimeout(int connectTimeout)Specify the timeout for connecting to the upstream server on a new connection, in milliseconds.HttpProxyServerBootstrapwithFiltersSource(HttpFiltersSource filtersSource)Specify aHttpFiltersSourceto use for filtering requests and/or responses through this proxy.HttpProxyServerBootstrapwithIdleConnectionTimeout(int idleConnectionTimeout)Specify the timeout after which to disconnect idle connections, in seconds.HttpProxyServerBootstrapwithListenOnAllAddresses(boolean listenOnAllAddresses)Deprecated.usewithNetworkInterface(InetSocketAddress)to avoid listening on all local addressesHttpProxyServerBootstrapwithManInTheMiddle(MitmManager mitmManager)Specify anMitmManagerto use for making this proxy act as an SSL man in the middleHttpProxyServerBootstrapwithMaxChunkSize(int maxChunkSize)HttpProxyServerBootstrapwithMaxHeaderSize(int maxHeaderSize)HttpProxyServerBootstrapwithMaxInitialLineLength(int maxInitialLineLength)HttpProxyServerBootstrapwithName(String name)Give the server a name (used for naming threads, useful for logging).HttpProxyServerBootstrapwithNetworkInterface(InetSocketAddress inetSocketAddress)All outgoing-communication of the proxy-instance is going' to be routed via the given network-interfaceHttpProxyServerBootstrapwithPort(int port)Listen for incoming connections on the given port.HttpProxyServerBootstrapwithProxyAlias(String alias)Sets the alias to use when adding Via headers to incoming and outgoing HTTP messages.HttpProxyServerBootstrapwithProxyAuthenticator(ProxyAuthenticator proxyAuthenticator)Specify aProxyAuthenticatorto use for doing basic HTTP authentication of clients.HttpProxyServerBootstrapwithSendProxyProtocol(boolean sendProxyProtocol)Specifies if the proxy server should send a proxy protocol header.HttpProxyServerBootstrapwithServerGroup(ServerGroup group)Specify a customServerGroupto use for managing this server's resources and such.HttpProxyServerBootstrapwithServerResolver(HostResolver serverResolver)Specify a customHostResolverfor resolving server addresses.HttpProxyServerBootstrapwithSslEngineSource(SslEngineSource sslEngineSource)Specify anSslEngineSourceto use for encrypting inbound connections.HttpProxyServerBootstrapwithThreadPoolConfiguration(ThreadPoolConfiguration configuration)Set the configuration parameters for the proxy's thread pools.HttpProxyServerBootstrapwithThrottling(long readThrottleBytesPerSecond, long writeThrottleBytesPerSecond)Specify the read and/or write bandwidth throttles for this proxy server.HttpProxyServerBootstrapwithTransparent(boolean transparent)Specify whether or not to run this proxy as a transparent proxy.HttpProxyServerBootstrapwithTransportProtocol(TransportProtocol transportProtocol)Specify theTransportProtocolto use for incoming connections.HttpProxyServerBootstrapwithUseDnsSec(boolean useDnsSec)Specify whether or not to use secure DNS lookups for outbound connections.
-
-
-
Method Detail
-
withName
HttpProxyServerBootstrap withName(String name)
Give the server a name (used for naming threads, useful for logging).
Default = LittleProxy
-
withTransportProtocol
HttpProxyServerBootstrap withTransportProtocol(TransportProtocol transportProtocol)
Specify the
TransportProtocolto use for incoming connections.Default = TCP
-
withAddress
HttpProxyServerBootstrap withAddress(InetSocketAddress address)
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.usewithNetworkInterface(InetSocketAddress)to avoid listening on all local addressesThis method has no effect and will be removed in a future release.
-
withSslEngineSource
HttpProxyServerBootstrap withSslEngineSource(SslEngineSource sslEngineSource)
Specify an
SslEngineSourceto use for encrypting inbound connections. Enabling this will enable SSL client authentication by default (seewithAuthenticateSslClients(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
ProxyAuthenticatorto use for doing basic HTTP authentication of clients.Default = null
-
withChainProxyManager
HttpProxyServerBootstrap withChainProxyManager(ChainedProxyManager chainProxyManager)
Specify a
ChainedProxyManagerto use for chaining requests to another proxy.Default = null
-
withManInTheMiddle
HttpProxyServerBootstrap withManInTheMiddle(MitmManager mitmManager)
Specify an
MitmManagerto use for making this proxy act as an SSL man in the middleDefault = null
Note - This and
withSslEngineSource(SslEngineSource)are mutually exclusive.
-
withFiltersSource
HttpProxyServerBootstrap withFiltersSource(HttpFiltersSource filtersSource)
Specify a
HttpFiltersSourceto 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 customHostResolverfor resolving server addresses.
-
withServerGroup
HttpProxyServerBootstrap withServerGroup(ServerGroup group)
Specify a customServerGroupto use for managing this server's resources and such. If one isn't provided, a default one will be created using theThreadPoolConfigurationprovided- Parameters:
group- A custom server group
-
plusActivityTracker
HttpProxyServerBootstrap plusActivityTracker(ActivityTracker activityTracker)
Add an
ActivityTrackerfor 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
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
-
-