Lua headers

agentzh agentzh at gmail.com
Mon Feb 28 10:56:41 MSK 2011


On Sun, Feb 27, 2011 at 7:23 AM, Richard Kearsley
<Richard.Kearsley at m247.com> wrote:
> Hi

Sorry for the delay. I've been on holiday in the next few days :P

> Is it possible to set the headers of a lua request to my auth server?

Yes, use the ngx_headers_more module's more_set_input_headers
directive or ngx_proxy module's proxy_set_header directive in your
auth server's proxy location.

    http://wiki.nginx.org/NginxHttpProxyModule#proxy_set_header

> I can set the querystring/args as shown in a few examples but never seen
> headers being set in lua?
>

BTW, by default, the main request's headers will be forwarded to your
subrequest destination locations. If that's not what you want, use the
proxy_pass_request_headers directive to disable that:

    http://wiki.nginx.org/NginxHttpProxyModule#proxy_pass_request_headers

For now, setting subrequest headers from within Lua is not implemented
yet in ngx_lua. But it's on our TODO list :)

Cheers,
-agentzh



More information about the nginx mailing list