6161 default 0; # All other traffic
6262 }
6363
64- # Provides $is_blessed_ua
65- include /olsystem/etc/nginx/is_blessed_ua. map ;
64+ include /olsystem/etc/nginx/is_blessed_ua.conf ; # Provides $is_blessed_ua
65+ include /olsystem/etc/nginx/is_sus_ip.conf ; # Provides $is_sus_ip
6666
6767 map "$is_blessed_ip:$is_blessed_ua" $rate_limit_key {
6868 "0:0" $binary_remote_addr ; # Rate-limit by IP
@@ -83,13 +83,16 @@ http {
8383 js_set $has_hit_crawler_links tagger.check;
8484
8585 # The only crawlers we want to limit are the ones that don't identify themselves as such
86- map "$is_blessed_ip:$is_identifying_ua:$has_hit_crawler_links" $global_nonidentifying_crawler_rate_limit_key {
86+ map "$is_blessed_ip:$is_identifying_ua:$has_hit_crawler_links:$is_sus_ip " $global_nonidentifying_crawler_rate_limit_key {
8787 default '' ; # No shared rate limiting
88- "0:0:1" '1' ; # Shared rate limit
88+ # Shared rate limit
89+ "0:0:1:0" 1;
90+ "0:0:1:1" 1;
91+ "0:0:0:1" 1;
8992 }
9093
9194 # Limit the crawlers that scrape links but don't ID themselves globally
92- limit_req_zone $global_nonidentifying_crawler_rate_limit_key zone =global_crawler_limit:5m rate=15r /s;
95+ limit_req_zone $global_nonidentifying_crawler_rate_limit_key zone =global_crawler_limit:5m rate=17r /s;
9396
9497 # Matches other sites
9598 limit_req_zone $rate_limit_key zone =web_limit:10m rate=1r /s;
@@ -98,6 +101,7 @@ http {
98101 limit_req_zone $rate_limit_key zone =api_limit:10m rate=180r /m;
99102 # Set a more permissive limit for covers because some pages might load 20+ covers.
100103 limit_req_zone $rate_limit_key zone =cover_limit:10m rate=400r /m;
104+ limit_req_zone $global_nonidentifying_crawler_rate_limit_key zone =global_crawler_cover_limit:5m rate=150r /s;
101105
102106 # Things are mounted into here by the docker compose file
103107 include /etc/nginx/sites-enabled/*;
0 commit comments