Add Header
This module provides an example of Add Header on both the client request and response.
- class callouts.python.extproc.example.add_header.service_callout_example.CalloutServerExample(*args: Any, **kwargs: Any)[source]
Bases:
CalloutServer
Example callout server.
For request header callouts we provide a mutation to add a header ‘{header-request: request}’, remove a header ‘foo’, and to clear the route cache. On response header callouts, we respond with a mutation to add the header ‘{header-response: response}’.
- on_request_headers(headers: envoy.service.ext_proc.v3.external_processor_pb2.HttpHeaders, context: ServicerContext) envoy.service.ext_proc.v3.external_processor_pb2.HeadersResponse [source]
Custom processor on request headers.
- Parameters:
headers (service_pb2.HttpHeaders) – The HTTP headers received in the request.
context (ServicerContext) – The context object for the gRPC service.
- Returns:
The response containing the mutations to be applied to the request headers.
- Return type:
service_pb2.HeadersResponse
- on_response_headers(headers: envoy.service.ext_proc.v3.external_processor_pb2.HttpHeaders, context: ServicerContext) envoy.service.ext_proc.v3.external_processor_pb2.HeadersResponse [source]
Custom processor on response headers.
- Parameters:
headers (service_pb2.HttpHeaders) – The HTTP headers received in the response.
context (ServicerContext) – The context object for the gRPC service.
- Returns:
The response containing the mutations to be applied to the response headers.
- Return type:
service_pb2.HeadersResponse