Limit Payload Size is a serverless integration available at Azion Marketplace.
The integration employs an edge function to evaluate request data and deny payloads that exceed a predefined limit. The function validates the request payload size by checking the
Content-Length header. The
Content-Length header is required, making it safe to read instead of always reading the body. The users are safeguarded against attempts to change the header’s value in this way, and reading the
Content-Length header is the best course of action from a performance standpoint.
Getting the integrationSection titled Getting the integration
To install the integration, follow these steps:
- Access Real-Time Manager (RTM) > Marketplace.
- On the Marketplace homepage, select the integration’s card.
- Once the integration’s page opens, click the Get It Now button, at the bottom-right corner of the page.
You’ll see a message indicating that your integration was successfully installed.
Configuring the integrationSection titled Configuring the integration
This is an edge firewall integration, so, you’ll have to instantiate the integration on the Edge Firewall page. Follow the steps below to do this.
Setting up the Edge Firewall ruleSection titled Setting up the Edge Firewall rule
To instantiate the Limit Payload Size integration, follow the steps:
- On the Products menu, select Edge Firewall in the SECURE section.
- Click the Add Rule Set button.
- Give an easy to remember name to your new rule.
- Select the domains you want to protect with the function.
- Click the Function switch to enable functions on your edge application.
- Click the Save button.
Done. Now you have instantiated the rule for your function.
Setting up the Edge Firewall functionSection titled Setting up the Edge Firewall function
To instantiate the Limit Payload Size integration, while still on the Edge Firewall page, select the Functions tab and follow these steps:
- Click the Add Function button.
- Give an easy to remember name to your instance.
- On the dropdown menu, select the Limit Payload Size function.
This action will load the function, showing a form with the function code and, just above it, two tabs: Code and Args. By clicking on the Code tab, you’ll be able to navigate through the code, but not to change it.
For this integration, you only have to pass one argument in the Args JSON file:
Some information about how this integration works:
max_payload_lengthis the maximum size of the payload you’ll accept.
- This field accepts bytes, kilobytes, and megabytes as argument.
- If you don’t specify the unit of the payload size, it’ll be assumed as bytes.
- If you don’t pass any argument, the function will bypass the execution.
- Whenever the size exceeds the threshold set by the user, the integration will return a 403 error.
Setting up the Edge Firewall Rules EngineSection titled Setting up the Edge Firewall Rules Engine
To finish, you have to set up the Rules Engine to configure the behavior and the criteria to run the function.
Still on the Edge Firewall page, select the Rules Engine tab and follow these steps:
- Click the New Rule button.
- Give a name to the rule.
- Select a criteria to run and catch the domain you want to run the integration on.
- Below, select a behavior to the criteria. In this case, it’ll be a Run Function.
- Select the adequate Limit Payload Size function according to the name you gave it in the instantiate step.
- Click the Save button.
Done. Now the Limit Payload Size integration is running for every request made to the domain you indicated.