Skip to content

feat: configure Vite proxy and Nginx for WebSocket traffic#15

Merged
omattsson merged 1 commit intomainfrom
feature/issue-8-websocket-proxy
Mar 15, 2026
Merged

feat: configure Vite proxy and Nginx for WebSocket traffic#15
omattsson merged 1 commit intomainfrom
feature/issue-8-websocket-proxy

Conversation

@omattsson
Copy link
Owner

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 /ws proxy entry with ws: true for WebSocket support in the Vite dev server; fix pre-existing wrong port 80808081 for the /api proxy target
  • frontend/nginx.conf: Add location /ws block with full WebSocket upgrade headers (Upgrade, Connection) and proxy_read_timeout 86400s to keep long-lived connections alive; fix pre-existing wrong port 80808081 for the /api/ proxy_pass target

Testing

  • Start the stack with make dev and verify /api requests reach the backend
  • Connect a WebSocket client to /ws and confirm the connection is proxied correctly in both dev (Vite) and production (Nginx)- Connect a WebSocket client to /ws and confirm the cot

- 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
Copilot AI review requested due to automatic review settings March 15, 2026 09:10
@omattsson omattsson merged commit 5b2e7ce into main Mar 15, 2026
2 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 /api proxy target to backend:8081 and add a /ws WebSocket proxy entry.
  • Update Nginx /api/ proxy_pass target to backend:8081.
  • Add an Nginx location /ws block that forwards WebSocket upgrade requests and keeps connections alive via proxy_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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants