Does anybody have a Cloudflare Tunnel working with rspack HMR yet?
If so could you please post your Cloudflare config and the devServer part of your rspack config?
I’ve been hammering on this for days and haven’t gotten it working yet.
In case anybody can just see from looking what’s wrong with my config, here it is:
Cloudflare Config
ingress:
# WebSocket routes (must come first due to path specificity)
- hostname: www.myDevDomain.com
path: /ws
service: ws://localhost:8080
- hostname: myDevDomain.com
path: /ws
service: ws://localhost:8080
- hostname: wss.myDevDomain.com
path: /ws
service: ws://localhost:8080
# HTTP routes
- hostname: myDevDomain.com
service: http://localhost:3000
- hostname: www.myDevDomain.com
service: http://localhost:3000
# Catch-all
- service: http_status:404
rspack Config
devServer: {
port: 8080,
host: '0.0.0.0',
allowedHosts: 'all',
hot: true,
client: {
overlay: true,
reconnect: 3,
webSocketURL: {
protocol: 'ws',
hostname: 'localhost',
port: 8080,
pathname: '/ws',
},
},
},
Update
Hmmm… Grok says :
YOU ARE 99% THERE — BUT YOU’RE RUNNING A DEV SERVER IN PRODUCTION
The Problem (in plain English)
You’re seeing:
text
GET https://www.myDevDomain.com/rspack/main.876de1f01b0e1953.hot-update.json 404 (Not Found)
[HMR] Cannot find update. Need to do a full reload!
This means:
Your frontend is trying to do “Hot Module Replacement” (HMR) over the internet — but the dev server files (*.hot-update.json) only exist on localhost
Why This Happens
Part
What’s Happening
ws://localhost:8080/ws
Your dev server (Vite, Webpack, Rspack )
wss://www.myDevDomain.com/ws
Cloudflare tunnels to that dev server
https://www.myDevDomain.com/rspack/...hot-update.json
Browser tries to fetch HMR assets from public domain
404
Those files don’t exist publicly — they’re only served on localhost
The Fix: STOP USING DEV SERVER IN PRODUCTION
You cannot use npm run dev behind Cloudflare Tunnel in production.
<<<<<<<<<
That seems to make sense.
2 Likes
onedurr
December 11, 2025, 4:44pm
3
Not sure if this is the same as what you were trying to do, but I finally got my Cloudflare dev tunnel working. After going in circles for an hour or so troubleshooting CSP and import errors, turned out to be an extremely simple change to fix.
Literally just had to add this to the dev Meteor settings file:
"public":{
"packages": {
"dynamic-import": {
"useLocationOrigin": true
}
}
},
and voila, the tunnel works again on Meteor 3!
For additional reference, this app is on Meteor v3.3.2 with this config in package.json
"meteor": {
"modern": {
"transpiler": {
"verbose": false
},
"minifier": true,
"webArchOnly": true,
"watcher": true
}
}
Thanks for posting this. If you change something in the code, does HMR work over the tunnel?