The version for our WAF rules is 3.1
But is the behavior in the below scenario accurate? Our app has no file upload use case nor capability to do so.
lets say a customer sends a request of 800KB body size
If the request body size is 800 KB, and assuming:
Max Request Body Size is set to 128 KB in the Azure Application Gateway.
File Upload Limit is set to 1 MB.
What happens:
The 800 KB request body exceeds the Max Request Body Size (128 KB).
Since there is no actual file upload, the gateway will try to buffer the request body up to the 128 KB limit.
However, because the File Upload Limit is 1 MB, the gateway can handle the request (even though it's not a literal file upload) by using the additional buffering capacity provided by the file upload limit.
The request will likely succeed since 800 KB is under the file upload limit of 1 MB.
If the request body size is 8 MB:
The Max Request Body Size is still 128 KB.
The File Upload Limit is 1 MB.
What happens:
The 8 MB request body exceeds both the Max Request Body Size (128 KB) and the File Upload Limit (1 MB).
Even though the request body isn't technically an uploaded file, it exceeds both limits, meaning the gateway cannot buffer the full request.
The gateway will reject the request with a 413 (Request Entity Too Large) error, since the 8 MB request exceeds the 1 MB file upload limit.
So, even if there's no file upload attached, the File Upload Limit still plays a role in determining how large of a request body the gateway can handle. If a request exceeds both limits, it will fail. In this case, the 8 MB request would fail.
1
-
When your Web Application Firewall policy is in prevention mode, Web Application Firewall logs and blocks requests and file uploads that are over the size limits.
-
When your Web Application Firewall policy is in detection mode, Web Application Firewall inspects the body up to the limit specified and ignores the rest. If the
Content-Length
header is present and is greater than the file upload limit, Web Application Firewall ignores the entire body and logs the request.
For Web Application Firewalls running Core Rule Set 3.1 (or lower), turning off the request body inspection allows for messages larger than 128 KB to be sent to Web Application Firewall, but the message body isn’t inspected for vulnerabilities
Reference:
Web application firewall request size limits in Azure Application Gateway – Azure portal | Microsoft Learn
Azure subscription limits and quotas – Azure Resource Manager | Microsoft Learn