Files
mqtt-broker-stack/frontend/nginx.conf
T
2026-09-20 09:23:04 +02:00

33 lines
1.1 KiB
Nginx Configuration File

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# SPA routing: serve index.html for any non-API, non-asset path.
location / {
try_files $uri $uri/ /index.html;
}
# REST API proxy (spec section 4: frontend -> backend over frontend-net).
location /api/ {
proxy_pass http://mqtt-backend:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
# Server-Sent Events (topic explorer): buffering would hold stream
# chunks until the buffer fills — disable it and allow long-lived
# connections. The backend also sends X-Accel-Buffering: no.
location /api/v1/topics/stream/ {
proxy_pass http://mqtt-backend:8000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_buffering off;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
}