Throttling Filter module
Edition |
Incubator (services) |
||
Git |
|||
Latest |
1.0
|
This Throttling Filter module provides filter functionality to throttle http requests coming to Magnolia.
This module is at the INCUBATOR level. |
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency>
<groupId>info.magnolia.tools</groupId>
<artifactId>magnolia-throttling-filter</artifactId>
<version>1.0</version>
</dependency>
Configuration
Add the filter configuration under /server/filters
in the Magnolia configuration app. The following code block shows a sample configuration.
- The Filter accepts three parameters
-
numberOfRequestsPerSecond
numberOfRequestsPerSecondByUser
requestType
throttling:
class: 'info.magnolia.throttling.filter.ThrottlingFilter'
enabled: true
jcr:primaryType: 'mgnl:content'
numberOfRequestsPerSecond: '0' (1)
numberOfRequestsPerSecondByUser: '1' (2)
requestType: 'GET' (3)
mappings:
throttle-home:
pattern: 'regex:^\/\home(\.html)?$'
1 | The numberOfRequestsPerSecond parameter accept Integer values. If you pass '0' to this parameter, there will be no limitation on the number of requests per second. This parameter limits the total number of requests that are coming to the url configured in the mappings section. |
2 | The numberOfRequestsPerSecondByUser parameter limits the total number of requests that are coming to the url configured in the mappings section by authenticated user. |
3 | The requestType parameter accepts request type (String). For example: GET , POST, PUT, etc. |
Requests that are not authenticated (no user logged-in) will fallback to ip-address and in case no ip-address is available will fallback to user session. |