Description
request-block
plugin implements a request blocking function based on request characteristics such as URL and request header. It can be used to protect internal resources from unauthorized access.
Configuration Fields
Name | Type | Requirement | Default Value | Description |
---|---|---|---|---|
block_urls | array of string | Optional. Choose one from following: block_urls , block_headers , block_bodies | - | HTTP URLs to be blocked. |
block_headers | array of string | Optional. Choose one from following: block_urls , block_headers , block_bodies | - | HTTP request headers to be blocked. |
block_bodies | array of string | Optional. Choose one from following: block_urls ,block_headers , block_bodies | - | HTTP request bodies to be blocked. |
blocked_code | number | Optional | 403 | HTTP response status code to be sent when corresponding request is blocked. |
blocked_message | string | Optional | - | HTTP response body to be sent when corresponding request is blocked. |
case_sensitive | bool | Optional | true | Whether to use case-senstive comparison when matching. Enabled by default. |
Configuration Samples
Block Specific Request URLs
According to the configuration above, following requests will be blocked:
Block Specific Request Headers
According to the configuration above, following requests will be blocked:
Block Specific Request Bodies
According to the configuration above, following requests will be blocked:
Only Enable for Specific Routes or Domains
In the rule sample of _match_route_
, route-a
and route-b
are the route names provided when creating a new gateway route. When the current route names matches the configuration, the rule following shall be applied. In the rule sample of _match_domain_
, *.example.com
and test.com
are the domain names used for request matching. When the current domain name matches the configuration, the rule following shall be applied. All rules shall be checked following the order of items in the _rules_
field, The first matched rule will be applied. All remained will be ignored.
Maximum Request Body Size Limitation
When block_bodies
is configured, body matching shall only be performed when its size is smaller than 32MB. If not, and no block_urls
or block_headers
configuration is matched, the request won’t be blocked. When block_bodies
is configured, if the size of request body exceeds the global configuration of DownstreamConnectionBufferLimits, a 413 Payload Too Large
response will be returned.