Allow or deny download file size by using Content-Length header
search cancel

Allow or deny download file size by using Content-Length header

book

Article ID: 166274

calendar_today

Updated On:

Products

ProxySG Software - SGOS

Issue/Introduction

Advanced policy for controlling downloads based on the value present in the response header of "Content-Length"

Resolution

  1. In the ProxySG appliance Management Console, select Configuration > Policy > Visual Policy Manager. The VPM opens.
  2. Create or edit a Web Access Layer.
  3. In the layer, create a rule with the following properties:
    Source: Any, or user or group.
    Destination: New > Response Header >Content-Length. Enter a regular expression (regex) for a content-length; see the Examples section following these steps.
    Action:  Allow or Deny.

As an example, to allow anything that is greater than 30 MB, follow the previous steps to enter the regex. Then, right-click the Destination field and set it to Negate. Because the regex represents content-length of 0 to 30MB, negating this content-length results in anything NOT between 0-30 MB being allowed.

Examples

Note: Where applicable, remove all spaces from the syntax.

1MB (0 - 999 999) - ^[0-9]{1,6}$

2MB (0 - 1 999 999) - ^[0-9]{1,6}$|^1[0-9]{ 6 }$

5MB (0 - 4 999 999) - ^[0-9]{1,6}$|^[1-4][0-9]{ 6 }$

10MB (0 - 9 999 999) - ^[0-9]{1,7}$

15MB (0 - 14 999 999) - ^[0-9]{1,7}$|^1[0-4][0-9]{6.EN_US}$

20MB (0 - 19 999 999) - ^[0-9]{1,7}$|^1[0-9]{ 7 }$

30MB (0 - 29 999 999) - ^[0-9]{1,7}$|^[1-2][0-9]{7.EN_US}$

50MB (0 - 49 999 999) - ^[0-9]{1,7}$|^[1-4][0-9]{7.EN_US}$

100MB (0 - 99 999 999) - ^[0-9]{1,8}$

150MB (0 - 149999999) - ^[0-9]{1,8}$|^1[0-4][0-9]{7.EN_US}$

200MB (0 - 199 999 999) - ^[0-9]{1,8}$|^1[0-9]{8.EN_US}$

250MB (0 - 249 999 999) - ^[0-9]{1,8}$|^1[0-9]{8.EN_US}$|^2[0-4][0-9]{7.EN_US}$

300MB (0 - 299 999 999) - ^[0-9]{1,8}$|^[1-2][0-9]{8.EN_US}$

500MB (0 - 499 999 999) - ^[0-9]{1,8}$|^[1-4][0-9]{8.EN_US}$

1000MB (0 - 999 999 999) - ^[0-9]{1,9}$

2000MB (0 - 1 999 999 999) - ^([0-9]{1,9}|[1][0-9]{1,9})$

3000MB (0 - 2999999999) - ^([0-9]{1,9}|[1-2][0-9]{1,9})$