Why I finally settled on Caddy as my Webserver/Proxy

Jordan Lee
Jordan Lee
Why I finally settled on Caddy as my Webserver/Proxy

Man have I been through the ringer trying to find a good solid webserver/proxy to use. I along with a good friend of mine who is a software engineer and also finds it fun to self host have been through so many webservers/proxies. Before I get started yes I know some of these are just proxies, yes I know that Caddy isnt really just a "proxy". But for the sake of this article I lets not get angry with how loosely I use both of these terms. I am fully aware of the differences and use cases for both. With that out of the way lets gets started!

So to begin, when my self hosted journey started around a year and a half ago. I didnt want a complicated solution and also I was just using internally so nginx proxy manager by jc21 was the perfect choice for me. It was a good interface for me to use. It handled my internal traffic perfectly and I was completely happy with it at the time. But as all self hosted labs/projects go your never finished, you're constantly are looking to make it better or use something new. My problem is wanting to use something new the second I read an article about it. I get board so easily and just love setting up new environments and doing so with new toys! Thus came along my Docker Swarm cluster using traefik! Heres a great article that Docker Swarm!

I had been watching some Hussein Nasser videos and came across his videos on traefik. Funny enough the one where he was stating that it was to complex and hard to understand. Me being the strange nerd I am took that as a challenge, plus traefik is just darn appealing. I loved this set up and it was a very seamless one at that when it came to using it for docker swarm ingress. Plus side to traefik and in my opinion still is the biggest one is the easy to get metrics. Oh and lets not forget the auto LetsEncrypt. However traefik isn't really tailored to homlab users or small time self hoster's. I'm not knocking it in a negative way by no means because it was never designed for that in the first place.

I ended up getting rid of this stack at home, and moving my apps to a DigitalOcean droplet. And with that came the need for something lighter. The answer to this? Caddy. Caddy2 to be exact, however its really just Caddy updated? The reason Caddy was appealing to me in the first place was because I needed to move some static sites from my s3 bucket to my droplet and it does an excellent job as a simple file server. But I also wanted everything in one place and I wanted the configuration to be a simple as possible. And let me tell you first hand, your not gonna get any simpler than caddy. It uses something called a CaddyFile that will load your config. This file can reside wherever you would like it to, and gets loaded when you run the caddy commands within that directory or with the path to that config file.

My caddy file is about 20 lines long and it serves my static sites "as a file server" and proxies my docker apps "as a reverse proxy", all while managing my LetsEncrypt certs as well. That's why I never went with standalone nginx or haproxy. The encryption was just a hassle. I understand the production need for acme but if you can take that pain out of the equation and still get the same results. Why not. Caddy is just too simple for me to not recommend. Granted so is nginx proxy manager but I was tired of the web ui. It got to where it would break on me and not properly change settings. I would deploy new containers of it and get the same issues. With Caddy I have it running outside of my docker environment directly on my server and it works better than a charm, more like a gem!

Great! Next, complete checkout for full access to DevMug
Welcome back! You've successfully signed in
You've successfully subscribed to DevMug
Success! Your account is fully activated, you now have access to all content
Success! Your billing info has been updated
Your billing was not updated