SPB Git

spb/earth-now Public License

earth-now.co — real-time planetary dashboard: live world metrics modeled, not streamed.

TypeScript 93% Shell 2.3% SQL 1.4% JavaScript 1.3% Dockerfile 1.2% CSS 0.8%
2.3 KB · 69 lines ini
Raw Blame History
1# earth-now.co2# Author:  Simon-Pierre Boucher3# Contact: contact@spboucher.ai4# File:    infra/nginx.conf5# Purpose: Reverse proxy — / → web:3000, /api|/v1|/sse|/badge → api:4000; SSE-safe (no buffering, 1 h read timeout)6#7# Kept portable on purpose: swapping ngrok for Cloudflare Tunnel or a plain LB8# later must not require app changes.910server {11    listen 80;12    server_name _;1314    # --- API ---------------------------------------------------------------15    location /api {16        proxy_pass http://api:4000;17        proxy_http_version 1.1;18        proxy_set_header Host $host;19        proxy_set_header X-Real-IP $remote_addr;20        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;21        proxy_set_header X-Forwarded-Proto $scheme;22    }2324    location /v1 {25        proxy_pass http://api:4000;26        proxy_http_version 1.1;27        proxy_set_header Host $host;28        proxy_set_header X-Real-IP $remote_addr;29        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;30        proxy_set_header X-Forwarded-Proto $scheme;31    }3233    # --- SSE: model distribution — never buffer, hold connections open ------34    location /sse {35        proxy_pass http://api:4000;36        proxy_http_version 1.1;37        proxy_set_header Host $host;38        proxy_set_header X-Real-IP $remote_addr;39        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;40        proxy_set_header X-Forwarded-Proto $scheme;41        proxy_set_header Connection "";42        proxy_buffering off;43        proxy_cache off;44        proxy_read_timeout 1h;45        proxy_send_timeout 1h;46        chunked_transfer_encoding off;47    }4849    # --- Badges: rendered by the api, CDN-cached upstream --------------------50    location /badge {51        proxy_pass http://api:4000;52        proxy_http_version 1.1;53        proxy_set_header Host $host;54        proxy_set_header X-Forwarded-Proto $scheme;55    }5657    # --- Everything else: Next.js web app ------------------------------------58    location / {59        proxy_pass http://web:3000;60        proxy_http_version 1.1;61        proxy_set_header Host $host;62        proxy_set_header X-Real-IP $remote_addr;63        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;64        proxy_set_header X-Forwarded-Proto $scheme;65        proxy_set_header Upgrade $http_upgrade;66        proxy_set_header Connection "upgrade";67    }68}69