upstream website_backend { server website:8000; } upstream frontend { server frontend:3000; } upstream mqtt_ws { server rmqtt:8080; } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 80; server_name _; set_real_ip_from 172.18.0.0/16; real_ip_header X-Forwarded-For; real_ip_recursive on; proxy_http_version 1.1; 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; location /api/v1/ { proxy_buffering off; proxy_cache off; proxy_read_timeout 60s; proxy_pass http://website_backend; } location /agency/ { proxy_pass http://website_backend; } location /whitelist/ { proxy_pass http://website_backend; } location /mqtt { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Sec-WebSocket-Protocol $http_sec_websocket_protocol; proxy_read_timeout 1h; proxy_send_timeout 1h; proxy_pass http://mqtt_ws; } location /feedback/ { proxy_pass http://website_backend/api/v1/feedback/; } location / { proxy_pass http://frontend; } }