sukesh-ak / setup-mosquitto-with-docker

How to setup Mosquitto MQTT Broker using docker with Authentication and Websocket support.
https://www.sukesh.me
The Unlicense
207 stars 37 forks source link

Caddy container continuously restarting, error in caddyfile? #7

Open jrjdavidson opened 3 months ago

jrjdavidson commented 3 months ago

Kia ora, I used the setup as described in 5.1 and got the following error. Switching protocol to http:// as suggested seems to fix the issue

Error: adapting config using caddyfile: parsing caddyfile tokens for 'reverse_proxy': parsing upstream 'ws://mqtt5:9001': the scheme ws:// is only supported in browsers; use http:// instead, at /etc/caddy/Caddyfile:2

Thanks for that write up!

sukesh-ak commented 3 months ago

@jrjdavidson Not too sure. I have it working the exact way mentioned on my Ubuntu server on Azure.

Use the mqttx client to test and use wss:// to connect and use port 433 from outside. Caddy should take that secured websocket request (since its wss) and forward it to local ws endpoint.

image

jrjdavidson commented 3 months ago

That is unexpected, I tested this on a fresh Ubuntu 22 machine on azure and got that error. This error caused the caddy container to restart continuously. Once I changed the caddy file to http:// instead of ws://, the container started without a hitch. And yes, I was able to connect to the server using the wss protocol once I changed the caddyfile. Might be worth making a note of it in the writeup? Or leave this open?

sukesh-ak commented 3 months ago

Will clean up and redo again on my end, once I get time. Till then will keep this open.

Thanks for the update.

sukesh-ak commented 1 month ago

@jrjdavidson What client were you using for testing?

jrjdavidson commented 1 month ago

desktop mqttx https://mqttx.app/

sukesh-ak commented 1 month ago

desktop mqttx https://mqttx.app/

For websocket test, use web version and see.