# Lua headers

**URL:** <https://www.ruby-forum.com/t/lua-headers/203773>\
**Category:** NGINX\
**Created:** [February 27, 2011, 12:23am UTC](https://www.ruby-forum.com/t/lua-headers/203773 "2011-02-27T00:23:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 27, 2011, 12:23am UTC](https://www.ruby-forum.com/t/lua-headers/203773/1 "2011-02-27T00:23:30Z")

</div>

Hi  
Is it possible to set the headers of a lua request to my auth server?  
I can set the querystring/args as shown in a few examples but never seen  
headers being set in lua?

Many thanks

Sent from my iPhone

---

<div class="post-metadata">

**Author:** ![rkoskela](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ce73a5/32.png) [@rkoskela](https://www.ruby-forum.com/u/rkoskela)\
**Post date:** [February 28, 2011, 8:57am UTC](https://www.ruby-forum.com/t/lua-headers/203773/2 "2011-02-28T08:57:56Z")

</div>

On Sun, Feb 27, 2011 at 7:23 AM, Richard K.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi

Sorry for the delay. I’ve been on holiday in the next few days 😛

> 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
