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
Are you running Tunnel on both ends?
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
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
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
Yeah, for arbitrary TCP directly to your domain, you would need Spectrum as an Enterprise Add-On
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.
That sucks 💔
Is there any other way to at least proxy my domain-ip so mqtt still works?
Proxied? No, at least not on Cloudflare
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?
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 WebSocketThanks for the help anyway!