Skip to content

Latest commit

 

History

History
71 lines (44 loc) · 3.82 KB

request-content-limit.md

File metadata and controls

71 lines (44 loc) · 3.82 KB
description
This page provides the technical details of the Request Content Limit policy

Request Content Limit

Overview

You can use the request-content-limit policy to specify a maximum request content length allowed. This limit is compared to the content length header of the request.

Functional and implementation information for the request-content-limit policy is organized into the following sections:

Examples

{% hint style="warning" %} This policy can be applied to v2 APIs and v4 HTTP proxy APIs. It cannot be applied to v4 message APIs or v4 TCP proxy APIs. {% endhint %}

{% tabs %} {% tab title="HTTP proxy API example" %}

"request-content-limit": {
  "limit": 1000
}

{% endtab %} {% endtabs %}

Configuration

Phases

The phases checked below are supported by the request-content-limit policy:

v2 PhasesCompatible?v4 PhasesCompatible?
onRequesttrueonRequesttrue
onResponsefalseonResponsefalse
onRequestContentfalseonMessageRequestfalse
onResponseContentfalseonMessageResponsefalse

Options

The request-content-limit policy can be configured with the following options:

PropertyRequiredDescriptionType
limittrueMaximum length of request content allowedint

Compatibility matrix

The following is the compatibility matrix for APIM and the request-content-limit policy:

Plugin VersionSupported APIM versions
1.xAll

Errors

HTTP status codeMessage
400The limit from the configuration is not correct.
413Incoming HTTP request payload exceed the size limit.
411The HTTP request is not chunked and does not specify the Content-Length header.

You can use the response template feature to override the default responses provided by the policy. These templates must be defined at the API level (see the API Console Response Templates option in the API Proxy menu).

Some possible responses are:

Errordescription
400Content-length is not a valid integer.
411The request did not specify the length of its content, which is required by the requested resource.
413The request is larger than the server is willing or able to process.

The error keys sent by this policy are as follows:

KeyParameters
REQUEST_CONTENT_LIMIT_TOO_LARGElength - limit
REQUEST_CONTENT_LIMIT_LENGTH_REQUIREDlimit

Changelogs

{% @github-files/github-code-block url="https://github.com/gravitee-io/gravitee-policy-request-content-limit/blob/master/CHANGELOG.md" %}