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.


Getting the integration

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 Install button.

You’ll see a message indicating that your integration was successfully installed.


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 an edge firewall

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 + Edge Firewall 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 Edge Functions switch to enable functions on your edge firewall.
  6. Click the Save button.

Done. Now you’ve instantiated the edge firewall for your function.

Setting up the Edge Firewall function

To instantiate the Limit Payload Size integration, while still on the Edge Firewall page:

  1. Select the Functions Instances tab.
  2. Click the + Function Instance button.
  3. Give an easy to remember name to your instance.
  4. On the dropdown menu, select the Limit Payload Size function.
  • This action will load the Arguments tab.
  1. On the Arguments tab, add the parameters.

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.
  1. Click the Save button.

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:

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

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


Contributors