proxy.plugin.grout_client 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.plugin.grout_client.GroutClientPlugin[source]#

Bases: proxy.proxy.GroutClientBasePlugin

_abc_impl = <_abc._abc_data object>#
resolve_route(route: str, request: proxy.http.parser.parser.HttpParser, origin: Tuple[str, int], server: Tuple[str, int]) Tuple[Optional[str], proxy.http.parser.parser.HttpParser][source]#

Returns a valid grout route string.

You MUST override this method. This method returns 2-tuple where first value is the “route” and second the “request” object.

For a simple pass through, simply return the “route” argument value itself. You can also return a dynamic value based upon “request” and “origin” information. E.g. sending to different upstream services based upon request Host header. Return None as “route” value to drop the request.

You can also modify the original request object and return. Common examples include strip-path scenario, where you would like to strip the path before sending the request to upstream.