How to install the Limit Payload Size integration through Azion Marketplace

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.


To install the integration, follow these steps:

  1. Access Azion Console > Marketplace.
  2. On the Marketplace homepage, select the integration’s card.
  3. 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.


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.

To instantiate the Limit Payload Size integration, follow the steps:

  1. On the Products menu, select Edge Firewall in the SECURE section.
  2. Click the Add Rule Set button.
  3. Give an easy to remember name to your edge firewall.
  4. Select the domains you want to protect with the function.
  5. Click the Function switch to enable functions on your edge application.
  6. Click the Save button.

Done. Now you have instantiated the edge firewall for your function.

Setting up the Edge Firewall function

Section 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:

  1. Click the Add Function button.
  2. Give an easy to remember name to your instance.
  3. 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:

{
"max_payload_length": "10kb"
}

Some information about how this integration works:

  • The max_payload_length is 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 Engine

Section 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:

  1. Click the New Rule button.
  2. Give a name to the rule.
  3. Select a criteria to run and catch the domain you want to run the integration on.
  4. Below, select a behavior to the criteria. In this case, it’ll be a Run Function.
  5. Select the adequate Limit Payload Size function according to the name you gave it in the instantiate step.
  6. Click the Save button.

Done. Now the Limit Payload Size integration is running for every request made to the domain you indicated.


Contributors