Is there a way to get the raw request from the client in a handler?

Maxim Dounin mdounin at
Wed Jan 9 17:18:48 UTC 2019


On Wed, Jan 09, 2019 at 03:16:16PM +0100, Ottavio Campana wrote:

> Dear Maxim,
> in the nginx documentation
> I find
> $request full original request line
> How is this variable populated? I was expecting that this variable is taken
> from an internal buffer. Or is it reconstructed?

For HTTP/1.x (and HTTP/0.9), a reference to the request line is 
explicitly saved in the r->request_line field when parsing a request, 
see ngx_http_process_request_line() in src/http/ngx_http_request.c.

For HTTP/2, it is reconstructed.  See ngx_http_v2_construct_request_line() 
in src/http/v2/ngx_http_v2.c.

Maxim Dounin

More information about the nginx mailing list