Skip to content

Commit

Permalink
roles/dspace: Add rate limit to more dynamic pages
Browse files Browse the repository at this point in the history
No user agent should be legitimately making more than one request
every five seconds (12/m) to dynamic pages like browse or Discover.
  • Loading branch information
alanorth committed Feb 3, 2019
1 parent 511d661 commit 36dfb07
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions roles/dspace/templates/nginx/default.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ server {
}
}

# rate limit requests to dynamic pages to protect against bots and malicious
# users (see the definition for the dynamicpages limit_req_zone later).
location ~ /(browse|discover|search-filter|most-popular) {
# rate limit for dynamic pages
limit_req zone=dynamicpages;

proxy_pass http://tomcat_http;
}

# tell robots not to index or follow links on dynamic pages (because we can't use * in robots.txt!)
# see: https://jira.duraspace.org/browse/DS-2962
location ~ /handle/[0-9]+/[0-9]+/(browse|discover|search-filter|most-popular) {
Expand Down

0 comments on commit 36dfb07

Please sign in to comment.