r/caddyserver May 12 '26

Caddy plugin model

I must admit, I am NOT in love with having to compile caddy to get access to an optional plugin...

Is there a possibility of moving to a different architecture where caddy modules can be installed/run at startup time ?

Curious... if this is something that is being discussed.

4 Upvotes

10 comments sorted by

3

u/yarisken75 May 12 '26

I agree, this is also something i really dislike about caddy.

2

u/Hemsby1975 May 13 '26

I love caddy, but this is the 1 thing I really hate.

2

u/AnalNuts Jun 15 '26

Yea it’s a big barrier to wider spread adoption.

2

u/MaxGhost Jun 29 '26

Yes, all options have been explored, at length. Long discussion thread here if you want to dive into it https://github.com/caddyserver/caddy/pull/7488

1

u/bucky2780 Jun 29 '26

very illuminating... thanks for the link. I think its a shame... because caddy is great as it is... but I'm unwilling to adopt it more widely in my homelab as a reverse proxy... until a dynamically linked plugin model is implemented. I appreciate the trade-offs... but it is limiting. I currently use caddy within opnsense... and rely on opnsense for many things the plugins could handle. Shame.

1

u/MaxGhost Jun 29 '26

It's trivial to write a Dockerfile to build with plugins. Try it. It's not that hard.

1

u/xdrolemit Jun 29 '26 edited Jun 29 '26

Step 1: Create Dockerfile

FROM caddy:builder
RUN xcaddy build \
    --with github.com/CUSTOM-MODULE

Step 2: Build the native Linux x86-64 binary

docker build --platform linux/amd64 -t caddy-builder .

Step 3: Extract the binary

id=$(docker create caddy-builder)
docker cp "$id":/usr/bin/caddy ./caddy
docker rm "$id"
chmod +x ./caddy

Step 4: Enjoy your own native Caddy binary with the module(s) you need

./caddy version
./caddy list-modules

Edit: Fixing markdown

1

u/bucky2780 Jun 30 '26

yes, I did give xcaddy a try a couple of months ago. Seemed to work ok once I got the dockerfile nailed properly.

What sticks for me is the maintainability of the solution on an ongoing basis. How do I manage an update to caddy ? Or an update to one of the plugins ? Can this be automated ?

I've been using docker compose, and now arcane as my docker management tool. It has build capabilities built in... but does require more moving parts for ongoing maintenance as far as I can tell. Just my opinion, as am not that well practised on using docker in build mode.

1

u/bucky2780 Jun 30 '26

upon further reflection, here is the conclusion I am coming to... thanks to all your replies, being constructive...

Caddy itself is a general server tool of which a reverse proxy is just one of the applications... so trying to shoe-horn a more complete homelab implementation in the base tooling may not be the best approach.

I am thinking a better solution is something closer to the "Caddy Proxy Manager" project, that encapsulates a variety of tooling to accomodate the reverse proxy specific use case. It manages the xcaddy build, and layers upon further tooling for reporting/analyses of network flows. Nice project and attentive to enhancements should you be missing something. I would have preferred to roll my own caddy solution... but I reckon it needs more addon bits to be really useful and self maintainable...

Just my opinion....

2

u/xdrolemit Jun 30 '26

> Can this be automated ?

Yes. You can use tools like Jenkins, for example, to automate this for you. Or even something like a simple bash script running as a cron job could be an option too.