When using resty-http from https://github.com/pintsized/lua-resty-http, how do I automatically set the headers returned in the backend server's response? Normally I can set headers via ngx.header.<header_name> and the nginx converts header_name to header-name (underscore to hyphen) and sets the header in the proxied response (e.g.: ngx.header.content_type = res.headers["Content-Type"]). The problem I have is when I don't know what header names will be returned, I can't set them using this method. I found an example of what looks like a for loop that should automatically set the response headers at https://github.com/pintsized/lua-resty-http/blob/master/t/01-basic.t
for k,v in pairs(res.headers) do
ngx.header[k] = v
end
but that did not set the headers in the client response. How can I loop through the headers in res.headers to automatically set them in the currest response headers?
thanks!