-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
47 lines (40 loc) · 1.5 KB
/
nginx.conf
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
worker_processes auto;
worker_cpu_affinity auto;
events {
worker_connections 1024;
multi_accept on;
use epoll;
}
http {
proxy_cache_path /dev/shm/nginx levels=1:2 keys_zone=download_cache:10m max_size=1024m inactive=1m use_temp_path=off;
server {
listen 8000;
server_name localhost;
# Disable caching for /v1/log_event
location /v1/log_event {
proxy_pass http://127.0.0.1:8001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Disable caching for this location
proxy_cache off;
}
# Cache everything else
location / {
proxy_pass http://127.0.0.1:8001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Enable caching
proxy_cache download_cache;
proxy_cache_methods GET POST;
proxy_cache_key "$request_method$request_uri$http_statsig_api_key$http_accept_encoding$request_body";
proxy_cache_use_stale updating error timeout http_500 http_502 http_503 http_504;
proxy_cache_background_update on;
proxy_cache_valid 200 5s;
proxy_cache_lock on;
}
}
}