New Caddy add-on

Caddy isn’t a TCP proxy, it’s an HTTP proxy. So you can’t use it to proxy standard MQTT. You can do that with something like HAProxy.

You can use Mosquitto in MQTT Websocket mode then use Caddy as a websocket proxy if you really want to use Caddy.

Thanks, I sort of understand. Trying to find some guidance in internet

I’m here to happily report that supervisor version 0.88 solved the problem. :+1:

1 Like

@Florian Aweseome! Thanks for letting me know.

I do not understand this …

Hi, I need some help.

Installed your addon and I think is working correctly except my mqtt Zanzito program

This is my caddy file

https://xxx-mqtt.duckdns.org {
tls /ssl/fullchain.pem /ssl/privkey.pem {
alpn http/1.1
}
proxy / 192.168.1.12:8883 {
transparent
websocket
}
log stdout
errors stderr
}

In my router I forwarded 8883 to 8883 of Hassio NUC

In Zanzito program i put as mqtt server address
xxx-mqtt.duckdns.org
Port 8883
Yes to sdl/tsl connection

But I receive connection refused

You really should use code blocks when posting configs @anon35356645. It is way harder to help you without. Check the blue box at the top if you don’t know how to do that.

By specifying https://xxx-mqtt.duckdns.org you did not configure Caddy for port 8883 but 443.

See the following examples from Caddy’s documentation:

:2015                    # Host: (any), Port: 2015
localhost                # Host: localhost; Port: 2015
localhost:8080           # Host: localhost; Port: 8080
example.com              # Host: example.com; Ports: 80->443
http://example.com       # Host: example.com; Port: 80
https://example.com      # Host: example.com; Ports: 80->443
http://example.com:1234  # Host: example.com; Port: 1234
https://example.com:80   # Error! HTTPS on port 80
*.example.com            # Hosts: *.example.com; Port: 2015
example.com/foo/         # Host: example.com; Ports: 80, 443; Path: /foo/
/foo/                    # Host: (any), Port: 2015, Path: /foo/

Thanks. I am on mobile, and formatting is not working.

I took out S and added :8883 so I have
http://xxx-mqtt.duckdns.org:8883
kept in router port 8883 forwarded to 8883

Now I received an error handshake failed. (I

You can keep the https as long as your port isn’t 80 :slightly_smiling_face:

Oh yes, I understand. Changed that.

But now is not connecting (no error, besides message connecting)

Ggrr

Okay, so Caddy should now be configured the way you initially wanted it to be.

If it’s still not working I’d expect it to be related to some kind of configuration for MQTT using websockets and not this add-on.

Googling that topic showed that this kind of communication uses port 9001, not 8883. So please make sure your MQTT server is properly configured and the client also supports websocket connections.

@anon35356645

Caddy is not a general purposed proxy (like HAProxy, for example.) It only proxies HTTP(S) traffic. MQTT, while being modeled after HTTP, is not compatible. Mosquitto, an MQTT server, does have some form of WebSocket-based MQTT that might work with Caddy’s WebSocket proxy, but I haven’t tested that.

1 Like

understood.

Also can you please explain me if possible to do as below: when I am outside my LAN type whats in the left and access my LAN as in the right

https://xxx.duckdns.org:8123 to 192.168.1.12:8123
https://xxx.duckdns.org:5050 to 192.168.1.12:5050
https://xxx.duckdns.org:8080 to 192.168.1.21:8080

With the following I receive error

https://xxx.duckdns.org:8123 {
tls /ssl/fullchain.pem /ssl/privkey.pem {
alpn http/1.1
}
proxy / 192.168.1.12:8123 {
transparent
websocket
}
log stdout
errors stderr
}

https://xxx.duckdns.org:8080 {
tls /ssl/fullchain.pem /ssl/privkey.pem {
alpn http/1.1
}
proxy / 192.168.1.21:8080 {
transparent
websocket
}
log stdout
errors stderr
}

https://xxx.duckdns.org:5050 {
tls /ssl/fullchain.pem /ssl/privkey.pem {
alpn http/1.1
}
proxy / 192.168.1.12:5050 {
transparent
websocket
}
log stdout
errors stderr
}

Sure, it’s totally possible. What’s the error you’re getting? I don’t see anything wrong with your config.

@korylprince Can we use Caddy plugins with your addon? I want to use a DNS provider.

I’m afraid not. Caddy is installed through Alpine’s package manager which comes with the default Caddy plugins. Caddy doesn’t currently allow any sort of dynamic plugin loading, so for now you’re out of luck.

1 Like

is the caddy version that comes with your addon outdated @korylprince?

based on the time you’ve released v1.3 i’m assuming we’re not already on caddy v0.11, but i’m not sure how i’m able to verify that.

1 Like

Hi I need some help too.

I installed the plugin and created a Caddyfile.txt. When I start the addon I get a error in the log: no such file or directory. I added the Caddyfile in a folder via Samba. In Share/caddy/

Am I doing something wrong? Thanks!

You have to use Caddyfile (no file extension)

Thanks, that helped. The addon started, but I get an error:

failed to get certificate: acme: Error 403…

Thanks.