content
content copied to clipboard
Websocket fails to connect when testing on non-localhost (e.g. via mobile)
Environment
- Operating System:
Darwin
- Node Version:
v19.5.0
- Nuxt Version:
3.1.1
- Nitro Version:
2.0.0
- Package Manager:
[email protected]
- Builder:
vite
- User Config:
modules
,vite
,runtimeConfig
,css
,app
,hooks
,content
,i18n
- Runtime Modules:
@nuxt/[email protected]
,@nuxtjs/[email protected]
- Build Modules:
-
Reproduction
View any Nuxt server in development from another device. Watch the Websocket try and fail to connect, repeatedly.
Describe the bug
The Websocket URL is hard-coded to use localhost
as hostname, which means when testing from another device, the Websocket tries to connect and fails repeatedly, spamming the console.
The issue is here: https://github.com/nuxt/content/blob/5f1c1349af774f10b26d250c1cc621f4b9912243/src/module.ts#L657
Additional context
No response
Logs
No response
I experience the same issue, have you found a workaround?
We are having the same problem, nuxt is running on a remote development server and local browser can't connect to the websocket.
Hello, can you provide a set up to reproduce this issue?
I came across the same problem. For whoever this may be useful: adding this to your nuxt.config.ts (inside defineNuxtConfig
's parameter object) disables the content watch, in case you don't really need it and want to get rid of the endless loop of websocket errors:
content: {
watch: false,
},