From 1cb14193c6c4aa87183f4d46047b8241bc00517a Mon Sep 17 00:00:00 2001 From: Baobhan Sith <80159437+Heavrnl@users.noreply.github.com> Date: Wed, 30 Apr 2025 11:27:39 +0800 Subject: [PATCH] Update nginx.conf --- packages/frontend/nginx.conf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/frontend/nginx.conf b/packages/frontend/nginx.conf index 28dffaf..d4e3086 100644 --- a/packages/frontend/nginx.conf +++ b/packages/frontend/nginx.conf @@ -29,6 +29,23 @@ server { proxy_set_header Connection "upgrade"; } + # Proxy WebSocket requests to the backend service + location /ws/ { + proxy_pass http://backend:3001; # Assuming backend handles WS on the same port + + # Required headers for WebSocket proxying + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + # Standard proxy headers + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; # Prevent caching issues + 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; + } + # Optional: Add headers for caching, security, etc. # Example: Cache assets aggressively location ~* \.(?:css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {