-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
28 lines (22 loc) · 806 Bytes
/
nginx.conf
File metadata and controls
28 lines (22 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
events {
worker_connections 1024;
}
http {
# This zone tracks every IP address individually.
# 10MB can hold 160,000 unique IPs—plenty for your needs.
limit_req_zone $binary_remote_addr zone=per_ip_limit:20m rate=10r/s;
server {
listen 80;
location / {
# APPLY THE LIMIT PER IP
# burst=15: High enough for a mobile app to fetch
# its initial data on startup without being blocked.
limit_req zone=per_ip_limit burst=15 nodelay;
proxy_pass http://api:3000;
# Critical: Pass the IP so Rust logs are accurate
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
}