feat: configure Vite proxy and Nginx for WebSocket traffic#15
Merged
Conversation
- Add /ws proxy entry in vite.config.ts with ws: true (dev) - Add location /ws block in nginx.conf with upgrade headers and proxy_read_timeout 86400s (production) - Fix pre-existing wrong port 8080 -> 8081 for /api proxy in both files Refs #8
There was a problem hiding this comment.
Pull request overview
Configures the frontend development (Vite) and production (Nginx) reverse proxies to properly forward WebSocket traffic to the Go backend, and aligns the proxy targets with the backend’s actual in-container port.
Changes:
- Update Vite dev-server
/apiproxy target tobackend:8081and add a/wsWebSocket proxy entry. - Update Nginx
/api/proxy_pass target tobackend:8081. - Add an Nginx
location /wsblock that forwards WebSocket upgrade requests and keeps connections alive viaproxy_read_timeout.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/vite.config.ts | Fixes backend proxy port and adds a /ws proxy entry with ws: true for dev WebSocket proxying. |
| frontend/nginx.conf | Fixes backend proxy port and adds a dedicated /ws location with upgrade headers and long read timeout for WebSockets. |
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Configures both the Vite dev server proxy and the production Nginx config to support WebSocket connections alongside the existing REST API proxy.
Changes
frontend/vite.config.ts: Add/wsproxy entry withws: truefor WebSocket support in the Vite dev server; fix pre-existing wrong port8080→8081for the/apiproxy targetfrontend/nginx.conf: Addlocation /wsblock with full WebSocket upgrade headers (Upgrade,Connection) andproxy_read_timeout 86400sto keep long-lived connections alive; fix pre-existing wrong port8080→8081for the/api/proxy_pass targetTesting
make devand verify/apirequests reach the backend/wsand confirm the connection is proxied correctly in both dev (Vite) and production (Nginx)- Connect a WebSocket client to/wsand confirm the cot