Remove upstream headers in envoy proxy after external authentication Remove upstream headers in envoy proxy after external authentication kubernetes kubernetes

Remove upstream headers in envoy proxy after external authentication


What about using the route level option request_headers_to_remove to remove an Authorization header?

See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto


Note that I am not an expert in envoy proxy, but from what I was able to find you can actually write a Lua script that would be able to remove the headers. In the documentation you can find an example of such script, and with a little bit of tinkering you should be able to customize it if needed:

-- Remove a response header named 'foo'response_handle:headers():remove("foo")

You can find more information in the official documentation. Here for config.filter.http.lua.v2.Lua and here are the script examples.