A proxy-wasm compliant WebAssembly module for making proxies convert an HTTP Cookie to a Header.
This proxy-wasm compliant WebAssembly module makes proxies convert a HTTP Cookie to a Header.
-
Download the latest WebAssembly module binary from the release page.
-
Configure the proxy to use the WebAssembly module like below (this assumes Envoy as the proxy):
listeners:
- name: example
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
# ...
http_filters:
- name: envoy.filters.http.wasm
typed_config:
'@type': type.googleapis.com/udpa.type.v1.TypedStruct
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm
value:
config:
vm_config:
runtime: envoy.wasm.runtime.v8
code:
local:
filename: /etc/envoy/proxy-wasm-http-cookie-header-convert.wasm
configuration:
"@type": type.googleapis.com/google.protobuf.StringValue
value: |
{
"cookie_name": "access_token",
"header_name": "authorization",
"header_value_prefix": "bearer "
}
- name: envoy.filters.http.router
typed_config:
'@type': type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
We can also configure this WebAssembly module for the per Route basis by using the Composite Filter. See the example envoy.yaml
for more details.
cookie_name
(Required)- The name of a HTTP Cookie you want to convert to a Header.
header_name
(Required)- The name of a destination HTTP Header.
header_value_prefix
(Optional)- The prefix of a destination HTTP Header.