-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
56 lines (46 loc) · 1.74 KB
/
nginx.conf
File metadata and controls
56 lines (46 loc) · 1.74 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
49
50
51
52
53
54
55
56
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
# Enable Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Rate limiting zone (10 reqs per second per IP)
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;
# SSL Config Placeholder
# ssl_certificate /etc/nginx/certs/fullchain.pem;
# ssl_certificate_key /etc/nginx/certs/privkey.pem;
server {
listen 80;
server_name proctor.local; # Change this for prod
# Redirect HTTP to HTTPS in production
# return 301 https://$host$request_uri;
# Frontend Route
location / {
proxy_pass http://frontend:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# Backend API Route
location /api/ {
# Apply rate limiting to API
limit_req zone=api_limit burst=20 nodelay;
limit_req_status 429;
proxy_pass http://backend:8080/api/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# WebSockets Route for STOMP (Admin Dashboard)
location /ws-admin/ {
proxy_pass http://backend:8080/ws-admin/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
}
}