Accessing HTTP request headers in nginx module

Mapper Uno lists at ruby-forum.com
Fri Mar 28 00:06:00 UTC 2014


Thanks for reply. However, I am still not clear how to access the
"custom" headers in module handler. Pls see my comments inline.

B.R. wrote in post #1141281:
> In nginx, you have the http_<header name> embedded variable in the core
> module
> <http://nginx.org/en/docs/http/ngx_http_core_module.html#variables>to
> access HTTP headers.
I can see that variables can be accessed by http_<header name>, however
the link says "names matching the Apache Server variables", which to me
indicates that these are not "custom" headers. With reference to my
above example, how can I access my custom header "OPERATION" in module
handler ?


> You can build the logic the way you want (through
> map<http://nginx.org/en/docs/http/ngx_http_map_module.html>or
> directives from the
> rewrite module
> <http://nginx.org/en/docs/http/ngx_http_rewrite_module.html>
> ).
>
> Using all that you can redirect to specific URL or backend with whatever
> arguments you wish to do the work for you.
>
Again, here I am not interested in forwarding any URL to any backend
server based on header. I simply to access and possibly iterate through
list of HTTP headers in module handler where I have reference to
ngx_http_request_t *r


> It is the UNIX way of doing things to separate components in individual
> processes, so I suggest you delegate the job to a third-party one which
> will listen for incoming requests.
> I would do that this way and keep nginx as close as possible from the
> lean
> genuine version to ensure updates are straightforward.
>
> My 2 cents,
> ---
> *B. R.*

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list