Noticable page refresh when using nginx proxy in front of vite #4795
Replies: 1 comment 1 reply
-
Two ways to solve this:
export default defineConfig({
// ...
server: {
hmr: {
port: 8888 // vite@2.5.2 and newer: clientPort
}
}
}) But why is it happening? |
Beta Was this translation helpful? Give feedback.
-
When a web server (e.g. nginx) is sitting in front of the vite dev server and acting as a proxy, there is a frequent visible page refresh that happens automatically.
If I remove the nginx proxy, the issue disappears. However, then I need to different cross-origins for the ui and api containers.
I've got an example repo that illustrates this behavior here: https://gitlab.com/fern-seed/web-vite-api-data
Requirements: docker, docker-compose
To use the browser included with Cypress, ensure you've run
xhost local:root
(on linux). Otherwise, mapboilerplate.local
to127.0.0.1
in/etc/hosts
:launch the services:
Navigate to the application in a browser. The automated page refresh is visible.
Any ideas on how to prevent the visible refresh without getting rid of the proxy?
Beta Was this translation helpful? Give feedback.
All reactions