This commit is contained in:
Baobhan Sith
2025-04-24 20:13:08 +08:00
parent a930f43477
commit e3139457ff
2 changed files with 72 additions and 0 deletions
+17
View File
@@ -11,6 +11,23 @@ server {
try_files $uri $uri/ /index.html;
}
# Proxy API requests to the backend service
location /api/ {
rewrite ^/api(/.*)$ $1 break; # Remove /api prefix before proxying
proxy_pass http://backend:3001; # Proxy to backend root
# Standard proxy headers
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;
# WebSocket support (if needed by the backend API)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Optional: Add headers for caching, security, etc.
# Example: Cache assets aggressively
location ~* \.(?:css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {