roeygol
roeygol

Reputation: 5038

nginx - where can I put client_max_body_size property?

I need to have a limit of max body size using - client_max_body_size property (over nginx.conf) on some url or even globally over my application.

I found this property documented over nginx site:

Syntax:   client_max_body_size size;
Default:  
client_max_body_size 1m;
Context:  http, server, location
Sets the maximum allowed size of the client request body, specified in the “Content-Length” request header field. If the size in

a request exceeds the configured value, the 413 (Request Entity Too Large) error is returned to the client. Please be aware that browsers cannot correctly display this error. Setting size to 0 disables checking of client request body size.

I need to make this property to a certain part of my app (not globally), so I want to set it to a specified url such as http://localhost:8088/x/#/y (# is mandatory)

What is the syntax for this certain url? Is it possible?

Upvotes: 0

Views: 1547

Answers (1)

Stefano Azzalini
Stefano Azzalini

Reputation: 1027

You can set client_max_body_size creating a location block:

location = /x {
   client_max_body_size 10M;
}

Unfortunately, since the fragment is never sent over http, there is no way to create a location block hooking the fragment.

I do not know the logic behind /x/#/y, but you could start setting client_max_body_size in /x.

Upvotes: 2

Related Questions