docs(hmr): document hmr.protocol setting#16056
Conversation
I wasn't sure if `protocol` should be `http` / `https` or `ws` / or `wss`. This commit documents that it should be the latter.
|
|
sapphi-red
left a comment
There was a problem hiding this comment.
Thanks!
BTW soon we will be able to pass http and https as well (whatwg/websockets#45).
|
@sapphi-red Interesting, thanks! I was doing some testing with Vite HMR and trying to set the Content Security Policy, but I noticed sometimes even though |
|
When the Vite server is stopped, the script injected by Vite sends a request periodically to the same path to reload the page when the Vite server is started again. I think those requests are the ones that are blocked. |
|
In my test, I have this config: {
"enabled": true,
"host": "127.0.0.1",
"port": 3038,
"hmr": {
"clientPort": 3443,
"host": "host.docker.internal",
"protocol": "wss"
}
}Thus, the Vite server should be accessed via I have a headless Chrome test that spins up on an arbitrary port (55498 below), and it uses a proxy server to block all external network access. When This error seems to go away if I enter vite/packages/vite/src/client/client.ts Lines 43 to 53 in 8dc1b73 |
|
Ah, I see that the ping here attempts to use vite/packages/vite/src/client/client.ts Lines 320 to 327 in 899d9b1 |
Obviously the code above would need to be changed if |
|
Ah, yeah, that code needs to be changed to |
|
@sapphi-red Do you know how to update https://vitejs.dev/config/server-options#server-hmr? I'm not seeing these changes there. |
|
@stanhu It'll be updated when we trigger it manually, it's now updated. |
I wasn't sure if
protocolshould behttp/httpsorws/ orwss. This commit documents that it should be the latter.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).