Forum: NGINX Reading "Accept" header from module

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chris Farmiloe (Guest)
on 2009-02-10 18:59
(Received via mailing list)
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.

Chris.
Maxim D. (Guest)
on 2009-02-11 01:49
(Received via mailing list)
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 D.
Chris Farmiloe (Guest)
on 2009-02-11 11:41
(Received via mailing list)
Enabling NGX_HTTP_HEADERS in the main build seems to give
me trouble... so I'll have a go at fetching things via
ngx_http_get_variable

thanks.

Chris
Igor S. (Guest)
on 2009-02-11 11:52
(Received via mailing list)
On Wed, Feb 11, 2009 at 09:29:24AM +0000, Chris Farmiloe wrote:

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

You need to add

have=NGX_HTTP_HEADERS . auto/have

in your <module>/config file.
This topic is locked and can not be replied to.