Reading "Accept" header from module

Chris Farmiloe chrisfarms at
Wed Feb 11 12:29:24 MSK 2009

Enabling NGX_HTTP_HEADERS in the main build seems to give
me trouble... so I'll have a go at fetching things via  



> Hello!
> On Tue, Feb 10, 2009 at 04:42:08PM +0000, Chris Farmiloe wrote:
>> Is the "Accept" header content made available on the request struct
>> anywhere? Or if there is an easy way to grab it from the raw headers?
>> .... defining NGX_HTTP_HEADERS seems to give me unpredictable results
>> when reading the data on request struct.
> It should be in r->headers_in->accept.  Please note that
> NGX_HTTP_HEADERS have to be defined for the whole nginx build, not
> just your module.
> Alternatively, you may just lookup $http_accept variable via
> ngx_http_get_variable().  This will work even without
> NGX_HTTP_HEADERS defined (and will trigger logic in
> ngx_http_variable_unknown_header_in() for arbitrary http header
> lookup).
> Maxim Dounin

More information about the nginx mailing list