Hi,
I'm implementing a proxy using Nginx and Nginx-Lua.
When the remote server (to which I'm proxying) sends a response without a "Content-Type" header, the Nginx-Lua module adds it (and sets its value to the default Nginx type).
When a browser receives a response with no "Content-Type" header, it assumes that it is "text/html", while the default Nginx type is usually "application/octet-stream".
In such cases, the addition of the header would causes the browsers to download the HTML files and not to load them.
Viewing (and debugging) the code, I've notice that this happens in two places in the code - the function ngx_http_lua_ngx_header_set and the function ngx_http_lua_send_header_if_needed. Removing these lines solves the problem...
Why is there an addition of the "Content-Type" header in the response headers if it is not set? If there is a good reason, is it okay to add a configuration directive stating whether or not we want to set this field?
I'll be happy to post a patch (or a pull request) :-)
Regards
Aviram