MQTT issues with sites hosted through cloudflare

434 views
Skip to first unread message

Kevin Crivelli

unread,
Jul 24, 2023, 3:20:12 PM7/24/23
to weewx-user
I have been able to get MQTT to work via my local address inside my network however when I attempt to do this at my website https://kevinheaven.net which goes through cloudflare I am unable to get this to work. I had discovered that cloudflare does not support the ports that mqtt work through. I am wondering if anyone else has run into this issue and if so has found a work around for it. I am using a public MQTT broker hive.mq.

Kevin Davis

unread,
Jul 24, 2023, 3:49:06 PM7/24/23
to weewx...@googlegroups.com
Do you know what ports ARE available to you?  You can change the port from 1883 in config.xml.

-Kevin

On Mon, Jul 24, 2023 at 8:20 AM Kevin Crivelli <kevinjc...@gmail.com> wrote:
I have been able to get MQTT to work via my local address inside my network however when I attempt to do this at my website https://kevinheaven.net which goes through cloudflare I am unable to get this to work. I had discovered that cloudflare does not support the ports that mqtt work through. I am wondering if anyone else has run into this issue and if so has found a work around for it. I am using a public MQTT broker hive.mq.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/0a014d25-6dc5-432c-b53e-0d6ccc299288n%40googlegroups.com.

gary....@gmail.com

unread,
Jul 26, 2023, 1:47:37 AM7/26/23
to weewx-user
If you read their docs/faq carefully, you will note that a ws/wss connection is not supported.
I get around this by proxying all except the mqtt server. That one is the same server, just a different cname.
Give that a try. It is the only 'solution' I could come up with.

Kevin Crivelli

unread,
Jul 26, 2023, 1:55:05 AM7/26/23
to weewx...@googlegroups.com
I get that in theory and I think I got close to setting that up right before but could you give me some more details on your setup? Do you just make like anl cname for the mqtt like mqtt.yourdnsname.com and turn off proxy for it. Here's the thing tho, I'm using a public mqtt server. Thought that would get around it.. I'm just confused but on the right track 

gary....@gmail.com

unread,
Jul 26, 2023, 11:40:51 AM7/26/23
to weewx-user
Doesn't matter where the mosquitto server is hosted, cloudflare doesn't allow WS or WSS
Yes, my server has it's own SSL cert and is a cname, no proxy via cloudflare.

gary....@gmail.com

unread,
Jul 26, 2023, 11:45:03 AM7/26/23
to weewx-user
What cloudflare service are you using?
I just do my DDNS with them, then I proxy all except the MQTT.
I thought about using their tunnel, but it would have required wholesale changes which I didn't want to do.
Reply all
Reply to author
Forward
0 new messages