Interface HttpProxy
- All Superinterfaces:
Handler<HttpServerRequest>
Handles the HTTP reverse proxy logic between the user agent and the origin.
- Author:
- Julien Viet
-
Method Summary
Modifier and TypeMethodDescriptiondefault HttpProxyaddInterceptor(ProxyInterceptor interceptor) Add an interceptor to the interceptor chain.addInterceptor(ProxyInterceptor interceptor, boolean supportsWebSocketUpgrade) Add an interceptor to the interceptor chain.voidhandle(HttpServerRequest request) Handle the outboundHttpServerRequest.default HttpProxySet the host name and port number of the origin.default HttpProxyorigin(SocketAddress address) Set theSocketAddressof the origin.origin(OriginRequestProvider provider) Set a provider that creates the request to the origin server based onProxyContext.static HttpProxyreverseProxy(HttpClient client) Create a newHttpProxyinstance.static HttpProxyreverseProxy(ProxyOptions options, HttpClient client) Create a newHttpProxyinstance.
-
Method Details
-
reverseProxy
Create a newHttpProxyinstance.- Parameters:
client- theHttpClientthat forwards outbound requests to the origin.- Returns:
- a reference to this, so the API can be used fluently.
-
reverseProxy
Create a newHttpProxyinstance.- Parameters:
client- theHttpClientthat forwards outbound requests to the origin.- Returns:
- a reference to this, so the API can be used fluently.
-
origin
Set theSocketAddressof the origin.- Parameters:
address- theSocketAddressof the origin- Returns:
- a reference to this, so the API can be used fluently
-
origin
-
origin
Set a provider that creates the request to the origin server based onProxyContext.- Parameters:
provider- the provider- Returns:
- a reference to this, so the API can be used fluently
-
addInterceptor
Add an interceptor to the interceptor chain.Interceptors are invoked in order of configuration. When added with this method, it is considered the interceptor doesn't support WebSocket upgrades.
- Parameters:
interceptor- theProxyInterceptorto add- Returns:
- a reference to this, so the API can be used fluently
-
addInterceptor
Add an interceptor to the interceptor chain.Interceptors are invoked in order of configuration.
- Parameters:
interceptor- theProxyInterceptorto addsupportsWebSocketUpgrade- whether the interceptor supports WebSocket upgrades- Returns:
- a reference to this, so the API can be used fluently
-
handle
Handle the outboundHttpServerRequest.- Specified by:
handlein interfaceHandler<HttpServerRequest>- Parameters:
request- the outboundHttpServerRequest
-