MQTT over Cloudflare

Hello I have a Mosquitto MQTT server and I wanted to use Cloudflare tunnels to send the raw TCP to the server from IOT sensors. But I couldn't really get that to work. Also proxys blocked the data aswell. Is there any solutions that you can think about?
11 Replies
Hard@Work
Hard@Work•4w ago
Are you running Tunnel on both ends?
KLevi
KLeviOP•4w ago
The docker container with the MQTT broker has the tunnel installed and set up. If you mean the clients, no the IOT device is not running it
Hard@Work
Hard@Work•4w ago
Yeah, that's the issue then. TCP Tunnels require Tunnels on the client too. You might be able to get it working if you point the IOT Device at the domain via a WebSocket
KLevi
KLeviOP•4w ago
The device right now only supports TCPIP and UDP I said right now as I plan on swapping the modems but that is for the future
Hard@Work
Hard@Work•4w ago
Yeah, for arbitrary TCP directly to your domain, you would need Spectrum as an Enterprise Add-On
Hard@Work
Hard@Work•4w ago
Cloudflare Docs
Cloudflare Spectrum
Spectrum allows you to route MQTT, email, file transfer, version control, games, and more over TCP or UDP through Cloudflare to mask the origin and protect it from DDoS attacks.
KLevi
KLeviOP•4w ago
That sucks 💔 Is there any other way to at least proxy my domain-ip so mqtt still works?
Hard@Work
Hard@Work•4w ago
Proxied? No, at least not on Cloudflare
KLevi
KLeviOP•4w ago
okay then. Probably time to upgrade to a 21st century modem and implement websockets. Could you please tell me about that? Or could you provide some help once I get the new modems?
Hard@Work
Hard@Work•4w ago
To be honest, I'm not super proficient with it either, but basically how I understand it is if you expose a TCP service via a Tunnel without Spectrum, your.host.com exposes a WebSocket pointing to that TCP service. You just need to construct the TCP packets as normal, and push them through the WebSocket
KLevi
KLeviOP•4w ago
Thanks for the help anyway!

Did you find this page helpful?