proxy.http.server.reverse module#

proxy.py#

⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.

copyright
  1. 2013-present by Abhinav Singh and contributors.

license

BSD, see LICENSE for more details.

class proxy.http.server.reverse.ReverseProxy(*args: Any, **kwargs: Any)[source]#

Bases: proxy.core.base.tcp_upstream.TcpUpstreamConnectionHandler, proxy.http.server.plugin.HttpWebServerBasePlugin

Extend in-built Web Server to add Reverse Proxy capabilities.

_abc_impl = <_abc._abc_data object>#
do_upgrade(request: proxy.http.parser.parser.HttpParser) bool[source]#

Signal web protocol handler to not upgrade websocket requests by default.

async get_descriptors() Tuple[List[int], List[int]][source]#

Implementations must return a list of descriptions that they wish to read from and write into.

handle_request(request: proxy.http.parser.parser.HttpParser) None[source]#

Handle the request and serve response.

handle_upstream_data(raw: memoryview) None[source]#
on_access_log(context: Dict[str, Any]) Optional[Dict[str, Any]][source]#

Use this method to override default access log format (see DEFAULT_WEB_ACCESS_LOG_FORMAT) or to add/update/modify passed context for usage by default access logger.

Return updated log context to use for default logging format, OR Return None if plugin has logged the request.

on_client_connection_close() None[source]#

Client has closed the connection, do any clean up task now.

on_client_data(request: proxy.http.parser.parser.HttpParser, raw: memoryview) Optional[memoryview][source]#

Return None to avoid default webserver parsing of client data.

async read_from_descriptors(r: List[int]) bool[source]#

Implementations must now read data over the socket.

routes() List[Tuple[int, str]][source]#

Return List(protocol, path) that this plugin handles.

async write_to_descriptors(w: List[int]) bool[source]#

Implementations must now write/flush data over the socket.

Note that buffer management is in-build into the connection classes. Hence implementations MUST call flush() here, to send any buffered data over the socket.