Accessing HTTP request headers in nginx module

Mapper Uno lists at
Thu Mar 27 23:04:03 UTC 2014


I am writing a small nginx module that needs to get/parse HTTP request
header and depending on it's value, needs to be do something.

ex.  curl -X POST -H "OPERATION: add"  http://localhost:80/calc
to add 2 numbers

ex.  curl -X POST -H "OPERATION: divide" http://localhost:80/calc
to divide 2 numbers


I know in Mongoose web server's callback routine, you can easily access
custom HTTP header with an API like

const char *value = mg_get_header(connection,  "OPERATION")

I could not find such an API in nginx. How can I get this functionality
in nginx module in handler routine ? Any help would be great


Posted via

More information about the nginx mailing list