working 3 tier approach
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user