-
This commit is contained in:
@ -24,7 +24,7 @@ server {
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Proxy to API service
|
||||
proxy_pass http://api-service:8080/;
|
||||
proxy_pass http://api-service:8080;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_send_timeout 60s;
|
||||
@ -47,8 +47,8 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Proxy to API service
|
||||
proxy_pass http://api-service:8080/;
|
||||
# Proxy to API service (cannot have URI part in regex location)
|
||||
proxy_pass http://api-service:8080;
|
||||
proxy_read_timeout 60s;
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_send_timeout 60s;
|
||||
@ -69,9 +69,23 @@ server {
|
||||
proxy_pass http://api-service:9090/metrics;
|
||||
}
|
||||
|
||||
# Default location - redirect to documentation
|
||||
# Default location - serve React frontend
|
||||
location / {
|
||||
return 301 /api/docs;
|
||||
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;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# Handle React Router (client-side routing)
|
||||
proxy_intercept_errors on;
|
||||
error_page 404 = @fallback;
|
||||
}
|
||||
|
||||
# Fallback for React Router
|
||||
location @fallback {
|
||||
proxy_pass http://frontend:80;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
# Custom error pages
|
||||
@ -90,8 +104,14 @@ server {
|
||||
add_header Content-Type application/json;
|
||||
}
|
||||
|
||||
# Security settings
|
||||
# Static assets - proxy to frontend with caching
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||
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;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
@ -127,7 +147,7 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_pass http://api-service:8080/;
|
||||
proxy_pass http://api-service:8080;
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,6 +167,6 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_pass http://api-service:8080/;
|
||||
proxy_pass http://api-service:8080;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user