Exempt localhost from nginx rate limits for Tor and AU usage
This commit is contained in:
		
							parent
							
								
									52c3a2beff
								
							
						
					
					
						commit
						2b8ef7a13a
					
				@ -54,13 +54,23 @@ http {
 | 
			
		||||
	proxy_cache_path /var/cache/nginx keys_zone=cache:20m levels=1:2 inactive=600s max_size=500m;
 | 
			
		||||
	types_hash_max_size 2048;
 | 
			
		||||
 | 
			
		||||
	# exempt localhost from rate limit
 | 
			
		||||
	geo $limited_ip {
 | 
			
		||||
		default		1;
 | 
			
		||||
		127.0.0.1	0;
 | 
			
		||||
	}
 | 
			
		||||
	map $limited_ip $limited_ip_key {
 | 
			
		||||
		1 $binary_remote_addr;
 | 
			
		||||
		0 '';
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	# rate limit requests
 | 
			
		||||
	limit_req_zone $binary_remote_addr zone=api:5m rate=200r/m;
 | 
			
		||||
	limit_req_zone $binary_remote_addr zone=electrs:5m rate=2000r/m;
 | 
			
		||||
	limit_req_zone $limited_ip_key zone=api:5m rate=200r/m;
 | 
			
		||||
	limit_req_zone $limited_ip_key zone=electrs:5m rate=2000r/m;
 | 
			
		||||
	limit_req_status 429;
 | 
			
		||||
 | 
			
		||||
	# rate limit connections
 | 
			
		||||
	limit_conn_zone $binary_remote_addr zone=websocket:10m;
 | 
			
		||||
	limit_conn_zone $limited_ip_key zone=websocket:10m;
 | 
			
		||||
	limit_conn_status 429;
 | 
			
		||||
 | 
			
		||||
	map $http_accept_language $header_lang {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user