RouteFilter to Manipulate Headers
On this page
RouteFilter Headers
This RouteFilter allows adding/setting/removing headers for a request.
Filter config
apiVersion: enroute.saaras.io/v1
kind: RouteFilter
metadata:
name: add-set-remove-request-response-headers
namespace: httpbin
spec:
name: add-set-remove-request-response-headers
routeFilterConfig:
config: |
{
"add_request_headers" : [
{ "name" : "req1-add" , "value" : "v1" },
{ "name" : "req2-add" , "value" : "v2" },
{ "name" : "proto-dynamic" , "value" : "%PROTOCOL%" }
],
"set_request_headers" : [
{ "name" : "req1-set" , "value" : "v1-req" },
{ "name" : "req2-set" , "value" : "v2-req" }
],
"remove_request_headers" : [
"req1-remove", "req2-remove"
],
"add_response_headers" : [
{ "name" : "res1-add" , "value" : "v1" },
{ "name" : "res2-add" , "value" : "v2" }
],
"set_response_headers" : [
{ "name" : "res1-set" , "value" : "v1-res" },
{ "name" : "res2-set" , "value" : "v2-res" }
],
"remove_response_headers" : [
"res1-remove", "res2-remove"
]
}
type: route_filter_headers
GatewayHost config
apiVersion: enroute.saaras.io/v1
kind: GatewayHost
metadata:
name: httpbin-9000-gatewayhost-httpbin-host
namespace: httpbin
spec:
routes:
- conditions:
- prefix: /
filters:
- name: regex-rewrite-filter
type: route_filter_regex_rewrite
- name: add-set-remove-request-response-headers
type: route_filter_headers
services:
- name: httpbin
port: 9000
virtualhost:
fqdn: '*'