Update Header
This module provides an example of overwrite a particular header value from the client and from the origin with a new value.
- class callouts.python.extproc.example.update_header.service_callout_example.CalloutServerExample(*args: Any, **kwargs: Any)[source]
Bases:
CalloutServer
Example callout server.
For request header callouts we provide a mutation to update a header ‘{header-request: request}’, and to clear the route cache.
On response header callouts, we respond with a mutation to update the header ‘{header-response: response}’.
- Usage:
To use this example callout server, instantiate the CalloutServerExample class and run the gRPC service.
- 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