27 lines
922 B
Nginx Configuration File
27 lines
922 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# SPA fallback — Angular router handles its own paths
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Proxy API calls to the backend service (only when running inside Docker)
|
|
location /api/ {
|
|
# When the env var is set, nginx resolves "api" to the backend container.
|
|
# In dev (HOST_MODE=dev) we proxy to localhost:8000 instead.
|
|
if ($host = localhost) {
|
|
# Only proxy when the port matches our dev setup
|
|
# See: https://serverfault.com/questions/777768/conditional-proxy-pass-in-nginx
|
|
}
|
|
proxy_pass http://api:8000;
|
|
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;
|
|
}
|
|
}
|