Changes before error encountered

Co-authored-by: pdf114514 <57948770+pdf114514@users.noreply.github.com>
Agent-Logs-Url: https://github.com/pdf114514/CarReservation/sessions/a42d4e36-a3cf-4ff7-b1cb-f076e601b1b8
This commit is contained in:
copilot-swe-agent[bot]
2026-03-22 04:25:00 +00:00
parent 0bd5efde2c
commit 761c7f1971
7 changed files with 107 additions and 24 deletions

View File

@@ -5,10 +5,10 @@ import net from 'net';
const backendOrigin = process.env.BACKEND_URL || 'http://localhost:3001';
/**
* Custom Vite plugin that tunnels WebSocket upgrade requests at /ws to the
* Custom Vite plugin that tunnels WebSocket upgrade requests at /api/ws to the
* backend via raw TCP. Vite's built-in proxy `ws: true` can silently drop
* upgrade events that Vite's own HMR handler intercepts first. This plugin
* hooks directly onto `httpServer.upgrade` and handles the /ws path before
* hooks directly onto `httpServer.upgrade` and handles the /api/ws path before
* Vite gets a chance to claim it.
*/
function wsProxyPlugin() {
@@ -16,7 +16,7 @@ function wsProxyPlugin() {
name: 'ws-proxy',
configureServer(server) {
server.httpServer?.on('upgrade', (req, socket, head) => {
if (req.url !== '/ws') return;
if (req.url !== '/api/ws') return;
const { hostname, port: rawPort } = new URL(backendOrigin);
const port = parseInt(rawPort) || 3001;