Advanced API Gateway: Requests Size
The API Gateway uses the default NGINX value of 1MiB
.
The request size is the maximum value of the payload body size associated with the request.
If a body exceeds the client_max_body_size
value, a 413 Request Entity Too Large response will be sent to the client.
Change the default size
Through the advanced section of the API Gateway is possible to change the default size allowed by client requests.
For example the directive
client_max_body_size 10m;
will allow for any request to have a request body up until a size of 10 MiB
.
If you put 0 as value, then any size of body request will be accepted.
How can you change the default size for all the request?
Go to Section: api-gateway/request-size.conf
To change the value just enter the following string and choose the value you want to set:
client_max_body_size 10m;
How can you change only the Backoffice request size?
Go to Section: api-gateway/backoffice-root-location-extension.conf
To change the value just enter the following string and choose the value you want to set:
client_max_body_size 16k;
In this case you'll change the maximum request size to
16KiB
only for the endpoints of the Backoffice Application.
How can you change only the request size of a specific root?
Go to Section: api-gateway/root-location-extension.conf
Here you fill find an empty file. To change the value just enter the following string and choose the value you want to set:
location ~ "^/example" {
client_max_body_size 1m;
proxy_pass http://$proxy_name$proxy_url;
}In this case you'll change the request size only for the locations that starts with the path
/example
.
Since the proxy_pass
variable is not inherited inside the location block, you must define it again.
In case of a change in proxy_name
or proxy_url
variables names this configuration will not work.