Created
March 19, 2013 18:08
-
-
Save mtourne/5198570 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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