Skip to main content
← All guides

Fix hot reload through a tunnel

Why qURL here

qURL™ carries the WebSocket behind hot reload and the Server-Sent Events behind streaming replies, so a remote viewer sees each edit as you save it. Keep the app private on your machine and invite that viewer by email, or send a one-time link for a quick look.

See how LayerV compares to Cloudflare Quick Tunnels →

Steps

qURL carries hot reload over WebSockets and streaming responses over Server-Sent Events while your app stays on your machine with no public URL. Allow .qurl.site in Vite’s server.allowedHosts or the exact browser hostname in Next.js allowedDevOrigins, then restart. A remote viewer then sees each edit as you save it.

  1. Tell the three failures apart

    A host rejection stops the page itself: Vite shows “Blocked request. This host is not allowed”, and next dev logs “Blocked cross-origin request to Next.js dev resource”. A WebSocket failure lets the page load, but edits never arrive, and the console shows the hot reload socket failing to connect. A Server-Sent Events problem leaves the page and hot reload working while a streamed response, such as a chat reply, stalls; in the Network tab its event-stream request never delivers events. Each has a different fix below.

  2. Host rejected: let the dev server accept the tunnel’s hostname

    Vite answers “Blocked request” for an unknown host, and Next.js 16.2 and later block cross-origin requests to dev resources, including the hot reload socket. Add .qurl.site (or your tunnel’s domain) to Vite’s server.allowedHosts, or the exact browser hostname to Next.js allowedDevOrigins, and restart. The Next.js fix guide under Related Resources shows how to get that hostname from the recipient without consuming their link.

  3. WebSocket failing: check the console for Vite’s fallback message

    If the WebSocket through the tunnel fails, Vite’s client falls back to connecting straight to the dev server, bypassing the tunnel, and logs “Direct websocket connection fallback.” That fallback only works on the machine running Vite, so a remote viewer gets no updates.

  4. Use a tunnel that carries WebSockets, or point Vite at it

    Vite’s docs list three fixes: have the proxy carry WebSockets; or set server.strictPort to true and server.ws.clientPort to the same value as server.port; or give server.ws.port a different value from server.port. Vite 8.1 renamed server.hmr to server.ws and still syncs the old names. Through qURL the hot reload socket carries edits to the remote browser; allow the hostname first.

    qurl publish http://127.0.0.1:5173
    qurl share <CRID>
  5. Stream stalling: check the tunnel carries Server-Sent Events

    This is not a hot reload problem: Vite’s hot reload uses a WebSocket, while chat replies, progress feeds and some dev tools stream over Server-Sent Events. Cloudflare Quick Tunnels do not support Server-Sent Events, so a stream that stalls there needs a different tool. Use qURL to carry the stream as each event is sent.

What the recipient sees

With the socket connected, an edit to the source appears in the browser opening the qURL link without a manual refresh.

Troubleshooting

Troubleshooting
If you seeDo this
qurl publish says the local app is not accepting TCP connectionsStart the app first and check that curl works on the same address. qurl publish connects to localhost as 127.0.0.1, so if your app listens only on IPv6 (on macOS or Linux, lsof -iTCP -sTCP:LISTEN -nP shows [::1]), publish 'http://[::1]:PORT' instead, or start the dev server with --host 127.0.0.1 and publish that address. Neither requires listening on your LAN. Keep the quotes: zsh treats the brackets as a pattern.
The recipient sees “Access link invalid”The link was already used or has expired. Run qurl share again and send the new link.
Show 7 more fixes
More troubleshooting
If you seeDo this
The recipient sees “Resource not found”The resource was deleted after the link was made. Publish the app again, then run qurl share and send the new link.
publish rejects http://127.0.0.1 with “only HTTPS URLs are allowed”, asks you to log in, or prints no Access: lineYour qURL CLI is out of date. On macOS run brew update, then brew upgrade qurl; elsewhere install the latest release. After updating, qurl --version prints 3.4.1 or later, and every publish is private by default.
publish says this Linux session “can’t reach a systemd user manager”You are in a container or sandbox without a user service manager. Run qurl publish with --foreground; sharing lasts as long as that process runs. Container and CI setup →
publish says “Quota Exceeded” with “protected resource limit reached”, or “Your qURL account has reached a plan limit”You can see this without an account: a device with no account can keep up to 3 active resources, with links that last up to 24 hours. Run qurl list --status active, then qurl delete <CRID> for any you no longer need (it asks you to confirm; --yes skips that). qurl stop keeps the resource, so it does not free a slot.
Updates work on your machine but not for the person you shared withThe Vite client fell back to a direct connection that only your machine can make. Check the console for the fallback message and use a tunnel that carries WebSockets.
A tool that streams with Server-Sent Events stalls on a Cloudflare quick tunnelQuick Tunnels do not support Server-Sent Events, which is a separate limit from WebSockets. Use qURL to carry Server-Sent Events without buffering.
webpack-dev-server shows “Invalid Host header”Its host check rejected the tunnel. Add the domain to devServer.allowedHosts; a leading dot covers subdomains. Set client.webSocketURL to auto://0.0.0.0:0/ws too, or the hot reload client asks for the dev server’s port through the tunnel; the webpack-dev-server guide has the config. In Create React App, WDS_SOCKET_HOST and WDS_SOCKET_PORT set where the hot reload socket connects. Avoid allowedHosts: ‘all’ and DANGEROUSLY_DISABLE_HOST_CHECK: both turn the check off, which webpack and Create React App warn against.

Frequently Asked Questions

Does qURL support WebSockets and hot reload?

Yes. qURL carries WebSocket upgrades, Server-Sent Events and streamed responses. Add .qurl.site to Vite’s server.allowedHosts. In Next.js, set QURL_DEV_ORIGIN_HOST to the recipient’s exact browser hostname for allowedDevOrigins and restart next dev.

Do Cloudflare quick tunnels support WebSockets?

Yes. Quick Tunnels run on Cloudflare Tunnel, which Cloudflare’s Tunnel FAQ says fully supports WebSockets. They do not support Server-Sent Events, and they allow 200 in-flight requests. A qURL link carries WebSockets and Server-Sent Events alike.

Should I set server.hmr or server.ws?

Either on Vite 8.1 and later, which renamed the WebSocket options to server.ws and keeps the old server.hmr names in sync. On earlier versions, use server.hmr.

Who else can reach my app while the link is open?

Opening the link starts a session for that browser, which lasts 1 hour by default. After a browser opens it, another browser on the same public IP cannot use its access. A script or agent that opens the link without a browser is admitted by its network address instead, which other devices on that public IP share until the session ends. A link admits whoever opens it: the API’s IP and country rules do not apply to the signed links qurl share issues. Keep your app’s own sign-in for anything sensitive.

Publish your app now

Install the CLI, then run one command. No sign-up, no API key.

Install the CLI →

Book a pilot

Tell us what to hide. We’ll scope a pilot.

Enterprise starts with a paid pilot on one application, typically 60 to 90 days, credited in full toward year one if you convert within 60 days. After that, an annual package sized to what you protect, not per seat.