To control file size for downloads, please see the recommended guidance detailed in the Tech. Doc. with the URL below, using the "response.header.content-length.as_number=" condition modifier, and with example provided.
response.header.content-length.as_number=
Note:
Test the value of the HTTP Content-Length response header.
The condition modifier, .as_number allows you to configure rules based on the actual number of bytes in the Content-Length HTTP response header. This is an alternative to the .regex condition modifier, which can lead to performance issues.
SG/ASG/ISG-Proxy
The response.header.content-length.as_number=10485760 in CPL means that the policy checks if the Content-Length in the HTTP response header is exactly 10 MB (10,485,760 bytes). The number is the size in bytes, and 10485760 bytes equals 10 MB.
Converting Bytes to GB:
To calculate content length for larger sizes, such as 2 GB, you can use the following conversion:
So for 2 GB:
2 GB = 2 × 1,073,741,824 bytes = 2,147,483,648 bytes
Example for 2 GB or more:
If you want to set a rule for responses with a content length of 2 GB or more, the CPL would look like this:
response.header.content-length.as_number=2147483648.. DENY
See the snippet below, for the sample install.
This will deny any HTTP response where the Content-Length is 2 GB or greater.
If you need a different size, just multiply the number of gigabytes by 1,073,741,824 to get the equivalent in bytes.