-
-
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
fix(hmr): client pinging behind a proxy on websocket disconnect (fix #4501) #5466
fix(hmr): client pinging behind a proxy on websocket disconnect (fix #4501) #5466
Conversation
…tme/vite into bug/4501-waitForSuccessfulPing
Our team experienced the same issue, we are running our vite development environment on k8s with using devspace. When we are replacing our common JS dependencies for development we are automatically restarting the whole node/vite process since the required During the restart the k8s load balancer returns status code 502 for a few seconds but the browser reloads already the page even if the vite process isn't up and running. A few more retries / waiting time would result in a better development experience inclusive checking the return code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved from my side.
looks like a alternative to #6090
In our last meeting we discussed that someone (hopefully from the community) with a matching environment should test this and report if everything worked. |
@mwarnerdotme would you run |
done! |
@wuxiaolin1949 @BirknerAlex could you confirm that this PR works for your setup? We can merge it if this is the case |
Yes |
Description
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 thebreak
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.Additional context
#4501
For my team, this occurs frequently because the proxy is a part of our API code - so whenever we are doing backend work and we need to restart our local API server, our frontend application loses state because the window reloads and can't connect to the proxy.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).