proxy: remove pomerium cookie and authorization from upstream requests (#687)

* proxy: remove pomerium cookie and authorization from upstream requests

* fix typo
This commit is contained in:
Caleb Doxsey 2020-05-11 18:01:10 -06:00 committed by Travis Groth
parent 5819bf1408
commit 593c47f8ac
7 changed files with 152 additions and 21 deletions

View file

@ -0,0 +1,18 @@
function envoy_on_request(request_handle)
local headers = request_handle:headers()
local dynamic_meta = request_handle:streamInfo():dynamicMetadata()
if headers:get("x-pomerium-set-cookie") ~= nil then
dynamic_meta:set("envoy.filters.http.lua", "pomerium_set_cookie",
headers:get("x-pomerium-set-cookie"))
headers:remove("x-pomerium-set-cookie")
end
end
function envoy_on_response(response_handle)
local headers = response_handle:headers()
local dynamic_meta = response_handle:streamInfo():dynamicMetadata()
local tbl = dynamic_meta:get("envoy.filters.http.lua")
if tbl ~= nil and tbl["pomerium_set_cookie"] ~= nil then
headers:add("set-cookie", tbl["pomerium_set_cookie"])
end
end