forked from Ponysearch/Ponysearch
doc: [fix] WARNING: Could not lex literal_block as "json"
docs/admin/filtron.rst:24: \ WARNING: Could not lex literal_block as "json". Highlighting skipped. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
af2cae6d1d
commit
0a7479f194
1 changed files with 93 additions and 62 deletions
|
@ -23,68 +23,99 @@ An example configuration can be find below. This configuration limits the access
|
||||||
|
|
||||||
.. code:: json
|
.. code:: json
|
||||||
|
|
||||||
[
|
[{
|
||||||
|
"name":"search request",
|
||||||
|
"filters":[
|
||||||
|
"Param:q",
|
||||||
|
"Path=^(/|/search)$"
|
||||||
|
],
|
||||||
|
"interval":"<time-interval-in-sec (int)>",
|
||||||
|
"limit":"<max-request-number-in-interval (int)>",
|
||||||
|
"subrules":[
|
||||||
{
|
{
|
||||||
"name": "search request",
|
"name":"roboagent limit",
|
||||||
"filters": ["Param:q", "Path=^(/|/search)$"],
|
"interval":"<time-interval-in-sec (int)>",
|
||||||
"interval": <time-interval-in-sec>,
|
"limit":"<max-request-number-in-interval (int)>",
|
||||||
"limit": <max-request-number-in-interval>,
|
"filters":[
|
||||||
"subrules": [
|
"Header:User-Agent=(curl|cURL|Wget|python-requests|Scrapy|FeedFetcher|Go-http-client)"
|
||||||
|
],
|
||||||
|
"actions":[
|
||||||
{
|
{
|
||||||
"name": "roboagent limit",
|
"name":"block",
|
||||||
"interval": <time-interval-in-sec>,
|
"params":{
|
||||||
"limit": <max-request-number-in-interval>,
|
"message":"Rate limit exceeded"
|
||||||
"filters": ["Header:User-Agent=(curl|cURL|Wget|python-requests|Scrapy|FeedFetcher|Go-http-client)"],
|
}
|
||||||
"actions": [
|
}
|
||||||
{"name": "block",
|
|
||||||
"params": {"message": "Rate limit exceeded"}}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "botlimit",
|
"name":"botlimit",
|
||||||
"limit": 0,
|
"limit":0,
|
||||||
"stop": true,
|
"stop":true,
|
||||||
"filters": ["Header:User-Agent=(Googlebot|bingbot|Baiduspider|yacybot|YandexMobileBot|YandexBot|Yahoo! Slurp|MJ12bot|AhrefsBot|archive.org_bot|msnbot|MJ12bot|SeznamBot|linkdexbot|Netvibes|SMTBot|zgrab|James BOT)"],
|
"filters":[
|
||||||
"actions": [
|
"Header:User-Agent=(Googlebot|bingbot|Baiduspider|yacybot|YandexMobileBot|YandexBot|Yahoo! Slurp|MJ12bot|AhrefsBot|archive.org_bot|msnbot|MJ12bot|SeznamBot|linkdexbot|Netvibes|SMTBot|zgrab|James BOT)"
|
||||||
{"name": "block",
|
],
|
||||||
"params": {"message": "Rate limit exceeded"}}
|
"actions":[
|
||||||
|
{
|
||||||
|
"name":"block",
|
||||||
|
"params":{
|
||||||
|
"message":"Rate limit exceeded"
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "IP limit",
|
"name":"IP limit",
|
||||||
"interval": <time-interval-in-sec>,
|
"interval":"<time-interval-in-sec (int)>",
|
||||||
"limit": <max-request-number-in-interval>,
|
"limit":"<max-request-number-in-interval (int)>",
|
||||||
"stop": true,
|
"stop":true,
|
||||||
"aggregations": ["Header:X-Forwarded-For"],
|
"aggregations":[
|
||||||
"actions": [
|
"Header:X-Forwarded-For"
|
||||||
{"name": "block",
|
],
|
||||||
"params": {"message": "Rate limit exceeded"}}
|
"actions":[
|
||||||
|
{
|
||||||
|
"name":"block",
|
||||||
|
"params":{
|
||||||
|
"message":"Rate limit exceeded"
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "rss/json limit",
|
"name":"rss/json limit",
|
||||||
"interval": <time-interval-in-sec>,
|
"interval":"<time-interval-in-sec (int)>",
|
||||||
"limit": <max-request-number-in-interval>,
|
"limit":"<max-request-number-in-interval (int)>",
|
||||||
"stop": true,
|
"stop":true,
|
||||||
"filters": ["Param:format=(csv|json|rss)"],
|
"filters":[
|
||||||
"actions": [
|
"Param:format=(csv|json|rss)"
|
||||||
{"name": "block",
|
],
|
||||||
"params": {"message": "Rate limit exceeded"}}
|
"actions":[
|
||||||
|
{
|
||||||
|
"name":"block",
|
||||||
|
"params":{
|
||||||
|
"message":"Rate limit exceeded"
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "useragent limit",
|
"name":"useragent limit",
|
||||||
"interval": <time-interval-in-sec>,
|
"interval":"<time-interval-in-sec (int)>",
|
||||||
"limit": <max-request-number-in-interval>,
|
"limit":"<max-request-number-in-interval (int)>",
|
||||||
"aggregations": ["Header:User-Agent"],
|
"aggregations":[
|
||||||
"actions": [
|
"Header:User-Agent"
|
||||||
{"name": "block",
|
],
|
||||||
"params": {"message": "Rate limit exceeded"}}
|
"actions":[
|
||||||
]
|
{
|
||||||
|
"name":"block",
|
||||||
|
"params":{
|
||||||
|
"message":"Rate limit exceeded"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,7 +132,7 @@ It listens on 127.0.0.1:4004 and forwards filtered requests to 127.0.0.1:8888 by
|
||||||
|
|
||||||
Use it along with ``nginx`` with the following example configuration.
|
Use it along with ``nginx`` with the following example configuration.
|
||||||
|
|
||||||
.. code:: bash
|
.. code:: nginx
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
|
|
Loading…
Reference in a new issue