-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx.conf
More file actions
48 lines (39 loc) · 1.38 KB
/
nginx.conf
File metadata and controls
48 lines (39 loc) · 1.38 KB
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
48
events {
worker_connections 1024;
}
http {
upstream serenibase_backend {
server serenibase-rest:8080;
}
server {
listen 80;
# Enable gzip compression
gzip on;
gzip_types text/plain application/json application/javascript text/css;
# API routes
location /api/ {
proxy_pass http://postgrest_backend;
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 CORS
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS";
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept, Content-Type";
if ($request_method = OPTIONS) {
return 200;
}
}
# Rate limiting
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
location /api/v1/ {
limit_req zone=api burst=20 nodelay;
proxy_pass http://serenibase_backend;
}
# Health check endpoint
location /health {
proxy_pass http://serenibase_backend/api/v1/health;
}
}
}