-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client pinging behind a proxy unexpected reload on websocket disconnect #13125
Comments
I'm not really sure how we can fix this. According to the comment which reverted the fix: vite/packages/vite/src/client/client.ts Lines 318 to 319 in 535795a
A successful websocket ping would've return 400, which we would want to reload in that case. As a fix, maybe we can check for |
@bluwy Then, we can get response and skip if Ifthis proposal is feasible, I will open a PR later. |
I think the easy way is fetching the current |
I believe try opening WebSocket instead of pinging by a normal HTTP would be a better solution as it would be surely consistent. |
Client pings Server every 1s in case of connection-lost This issue cause high cpu usage. |
Describe the bug
This issue was reported before in this issue #4501, and a fix was implemented in #5466.
However, this change reverted by #6819
When websocket behind a proxy is disconnected, the fetch request result is 4xx or 5xx , Fetch promises only reject with a TypeError when a network error occurs. Since 4xx and 5xx responses aren't network errors, there's nothing to catch.
So the page reloads, but it cannot load because the proxy server is down.
Description ---- from issue #5466
When running the Vite dev server behind a proxy, the fetch request results in a 502 status code. This 502 does not throw an error, triggering the catch statement. Instead, the loop breaks (because of the break statement on the next line). When it breaks, the page reloads, but it cannot load because the proxy server is down. This causes those of us working behind proxies to lose frontend application state whenever the proxy restarts.
Reproduction
Steps to reproduce
No response
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: