Skip to content

fix(websocket): client url for development with proxy #3343

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

Closed
dargmuesli opened this issue May 11, 2025 · 1 comment
Closed

fix(websocket): client url for development with proxy #3343

dargmuesli opened this issue May 11, 2025 · 1 comment

Comments

@dargmuesli
Copy link
Member

dargmuesli commented May 11, 2025

Environment

irrelevant

Version

v3.5.1

Reproduction

not possible to replicate service structure in stackblitz

Description

When running Nuxt development behind a reverse proxy like traefik, the client websocket's client URL does not necessarily match the websocket server URL. For instance, the reverse proxy can terminate SSL while Nuxt runs plain http, making the current websocket implementation offer ws: as protocol while it should be wss:.

The server can't know under which address it's offered to the client, so the client side needs to device whether to try wss or ws first, depending on the mode Nuxt is served to it. The same goes for the hostname.

Actually, vite's hmr server connection is constructed in a similar fashion, that's why it works right away in all contexts:

Image

Additional context

I'll submit a PR right away: #3344

Actually, if anyone wants to test as setup with a reverse proxy, content.watch.hostname needs to be set to 0.0.0.0, but that's up to the user project to define, not in this module's source.

Logs

@farnabaz
Copy link
Member

fixed in #3344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants