Welcome! Log In Create A New Profile

Advanced

Re: request body and client_body_buffer_size

Maxim Dounin
September 16, 2013 03:16AM
Hello!

On Fri, Sep 13, 2013 at 05:56:51PM -0700, Jeroen Ooms wrote:

> Is it correct that when $content_length > client_body_buffer_size,
> then $request_body == "" ? If so this would be worth documenting at
> request_body.

Yes, it's intended behaviour. If a request body is larger than
client_body_buffer_size, it's written to disk and not available in
memory, hence no $request_body. The limitation is more or less
obvious, and it's also explicitly documented here in
the $r->request_body() method documentation:

http://nginx.org/en/docs/http/ngx_http_perl_module.html#methods

It might worth adding some short reference into $request_body
variable description though.

> I am using:
>
> proxy_cache_methods POST;
> proxy_cache_key "$request_method$request_uri$request_body";
>
> Which works for small requests, but for large requests clients got
> very strange results due to $request_body being empty and hence
> getting false cache hits for completely different form posts.
>
> Is there something available like $body_hash that can be used as a
> caching key even for large request bodies? Or alternatively, how
> would I configure nginx to not cache requests when content_length
> is larger than client_body_buffer_size?

The

proxy_no_cache $request_body_file;

should do the trick, see http://nginx.org/r/proxy_no_cache.

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

request body and client_body_buffer_size

Jeroen Ooms September 13, 2013 08:58PM

Re: request body and client_body_buffer_size

Maxim Dounin September 16, 2013 03:16AM

Re: request body and client_body_buffer_size

Maxim Dounin September 16, 2013 03:16AM

Re: request body and client_body_buffer_size

Jeroen Ooms September 16, 2013 03:16AM

Re: request body and client_body_buffer_size

Jeroen Ooms September 25, 2013 08:44PM

Re: request body and client_body_buffer_size

Maxim Dounin September 26, 2013 08:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 149
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready