Skip to content

Instantly share code, notes, and snippets.

@mtourne
Created March 19, 2013 18:08
Show Gist options
  • Save mtourne/5198570 to your computer and use it in GitHub Desktop.
Save mtourne/5198570 to your computer and use it in GitHub Desktop.
-- list of headers where tables are allowed
local ALLOWED_MULTI_HEADERS = {
["cookie"] = true,
}
local function sanitize_req_headers(req_headers)
for k, v in pairs(req_headers) do
if type(v) == "table" then
if not ALLOWED_MULTI_HEADERS[k] then
req_headers[k] = v[1]
end
end
end
return req_headers
end
ngx.req.get_headers = function ()
return sanitize_req_headers(ngx_req_get_headers())
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment