-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add config snippet and 429.http file.
The haproxy.cfg file contains just a snippet to be modified and included in your own HAProxy configuration. The 429.http file can be used verbatim.
- Loading branch information
1 parent
fb3c173
commit f692fb4
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
HTTP/1.1 429 Too Many Requests | ||
Cache-Control: no-cache | ||
Connection: close | ||
Content-Type: text/plain | ||
Retry-After: 60 | ||
|
||
Too Many Requests (HAP429). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
frontend fe_api_ssl | ||
bind 192.168.0.1:443 ssl crt /etc/haproxy/ssl/api.pem no-sslv3 ciphers ... | ||
default_backend be_api | ||
|
||
tcp-request inspect-delay 5s | ||
|
||
acl document_request path_beg -i /v2/documents | ||
acl is_upload hdr_beg(Content-Type) -i multipart/form-data | ||
acl too_many_uploads_by_user sc0_gpc0_rate() gt 100 | ||
acl mark_seen sc0_inc_gpc0 gt 0 | ||
|
||
stick-table type string size 100k store gpc0_rate(60s) | ||
|
||
tcp-request content track-sc0 hdr(Authorization) if METH_POST document_request is_upload | ||
|
||
use_backend 429_slow_down if too_many_uploads_by_user mark_seen | ||
|
||
backend be_429_slow_down | ||
timeout tarpit 2s | ||
errorfile 500 /etc/haproxy/errorfiles/429.http | ||
http-request tarpit | ||
|
||
backend be_api | ||
... |