Cookie from a http_request_t - howto?

Is there a simple example of how to read a cookie, or some other header
value, like “Host” from an ngx_http_request_t ?
I see $variables discussed, but I’m not sure how to retrieve them.

I am guessing it has something to do with ngx_http_script_compile/run,
but I don’t fully understand the concept.
Those functions seem to rely on a config file, but what if I’m not
interested in configuring the variable, I just wish to
retrieve Host or a specific Cookie from each request.

Also, at which stage in an upstream module process is the http request
filled?
Are they available in both init_peer and get_peer?

Thanks,

Rick

Posted at Nginx Forum:

I just found http://wiki.nginx.org/HeadersManagement

which has been a huge help. My remaining questions:

  1. Also, at which stage in an upstream module process is the http
    request filled?
    Are they available in both init_peer and get_peer?

  2. Is there a helper function for finding a cookie of a specific name?

Thanks,
Rick

Posted at Nginx Forum: