Merge pull request #2230 from bookwyrm-social/nginx-rate-limit

Adds rate limiting to some views in nginx
This commit is contained in:
Mouse Reeve 2022-07-28 11:26:19 -07:00 committed by GitHub
commit 7bbe42fb30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View file

@ -7,6 +7,15 @@ upstream web {
server { server {
listen 80; listen 80;
location ~ ^/(login|password-reset|resend-link) {
limit_req zone=loginlimit;
proxy_pass http://web;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location / { location / {
proxy_pass http://web; proxy_pass http://web;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -41,6 +41,15 @@ server {
# root /var/www/certbot; # root /var/www/certbot;
# } # }
# #
# location ~ ^/(login|password-reset|resend-link) {
# limit_req zone=loginlimit;
#
# proxy_pass http://web;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $host;
# proxy_redirect off;
# }
#
# location / { # location / {
# proxy_pass http://web; # proxy_pass http://web;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View file

@ -1 +1,2 @@
client_max_body_size 10m; client_max_body_size 10m;
limit_req_zone $binary_remote_addr zone=loginlimit:10m rate=1r/s;