Skip to content

Commit 71832b3

Browse files
committed
chore: Add more granular rate limiting
1 parent 5013744 commit 71832b3

1 file changed

Lines changed: 42 additions & 9 deletions

File tree

netlify.toml

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22
command = "make netlify-build"
33
publish = "build/site"
44

5-
# Rate limiting across the whole page. 250 request per 60 seconds aggregated by client IP.
6-
[[redirects]]
7-
from = "/*"
8-
to = "/:splat"
9-
[redirects.rate_limit]
10-
window_limit = 250
11-
window_size = 60
12-
aggregate_by = ["ip"]
13-
145
[[redirects]]
156
from = "/home/stable/reference/*"
167
to = "https://hub.stackable.tech/crds"
@@ -20,3 +11,45 @@
2011
from = "/home/stable/release_notes.html"
2112
to = "/home/stable/release-notes"
2213
status = 301
14+
15+
# -------------
16+
# RATE LIMITING
17+
# All rate limiting is aggregated by client IP and domain (domain is added automatically by Netlify)
18+
# Redirects/rules are evaluated from top to bottom and the first match will always be used by Netlify.
19+
# -------------
20+
21+
#---------------------
22+
# ASSETS RATE LIMITING
23+
# These limits can be set higher, because most automated requests/attacks will most likely only
24+
# request the page itself and not its assets.
25+
# --------------------
26+
27+
# Rate limit access to assets. This redirect rule/rate limit comes BEFORE the catch-all.
28+
[[redirects]]
29+
from = "/_/*"
30+
to = "/_/:splat"
31+
[redirects.rate_limit]
32+
window_limit = 250
33+
window_size = 60
34+
aggregate_by = ["ip"]
35+
36+
# Rate limit pagefind (search) resources. This redirect rule/rate limit comes BEFORE the catch-all.
37+
[[redirects]]
38+
from = "/pagefind/*"
39+
to = "/pagefind/:splat"
40+
[redirects.rate_limit]
41+
window_limit = 250
42+
window_size = 60
43+
aggregate_by = ["ip"]
44+
45+
#------------------------
46+
# CATCH-ALL RATE LIMITING
47+
# -----------------------
48+
49+
[[redirects]]
50+
from = "/*"
51+
to = "/:splat"
52+
[redirects.rate_limit]
53+
window_limit = 50
54+
window_size = 60
55+
aggregate_by = ["ip"]

0 commit comments

Comments
 (0)