Readit News logoReadit News
no_wizard · 2 years ago
Caddy is a wonderful alternative for nginx for small / medium sized projects I've worked with it on. Mid market enterprise is where I have seen alot of Caddy uptick as of late.

nginx has a ton of inertia, but Caddy is a welcome player. I highly recommend anyone into this sort of thing give it a try. The configuration is so easy by comparison and its handling of HTTPS certs automatically is a huge win.

I feel its a leap forward from the typical Apache / nginx setup to me nowadays

polishdude20 · 2 years ago
I've used Caddy in the past and it worked well but the syntax for their config caddyfile is just so confusing. I haven't found a tutorial to explain how it all works properly.
francislavoie · 2 years ago
We recommend starting here, to understand the structure: https://caddyserver.com/docs/caddyfile/concepts

Anything in particular you find confusing?

mholt · 2 years ago
We're revamping our docs this year; you can often express what you need in in JSON if it's not elegant in the Caddyfile.
bklyn11201 · 2 years ago
Caddy is indeed wonderful for straightforward and simple projects.

There are a number of complex configurations used by larger organizations that are well served today by Nginx Plus, HAProxy, and Traefik that don't seem possible with Caddy. And it's difficult to get a sense of whether the Caddy developers are interested in meeting those more complex use cases or whether they want to keep Caddy smaller and simpler.

But yes, by all means, for a simple project pick Caddy!

mholt · 2 years ago
Caddy is more capable and extensible than all those servers, even out of the box. Example: https://github.com/traefik/traefik/issues/5472#issuecomment-...

> welcome to 2024. it is shame that traefik cannot handle functionality which can be handled by caddy2.

(posted this morning)

Anyway, we already do walk up to quite a few complex requirements in large enterprise deployments. Happy to hear about your use case that isn't possible!

bosch_mind · 2 years ago
Can you speak more to usecases that aren’t fulfilled by Caddy? Also, any ideas if performance matches NGINX at scale?
turtlebits · 2 years ago
I've tried to use Caddy several times (once before the config lang changed and once after). Configuration was a nightmare, mainly because it doesn't throw on what should be bad configs and things just don't work as expected.
francislavoie · 2 years ago
I don't think that's as true anymore. We've put a lot of effort on adding errors/warnings on bad config. But it's hard to imagine all the "wrong" ways users can try to configure Caddy. If there's something you don't find obvious, please ask us for help on our forums, or open an issue on GitHub if you think it's a bug. Feedback is extremely important for us to be able to improve!
drcongo · 2 years ago
Agree with all of this - Caddy is a great project.
mholt · 2 years ago
Thanks for the feedback!

Just want to say, it's great for large deployments too! (Ask Stripe and Framer)

mmh0000 · 2 years ago
I love caddy. Most recently, I used it for a small personal project where I wanted to be able to upload files via Webdav and serve them out over HTTPS. I can't believe how small the configuration for this setup is. Especially if you compare it to something like Apache:

```

  {
      order webdav before file_server
      log {
          level DEBUG
      }
  }
  
  files.example.org {
      log {
          output stdout
          format json
      }
      @notget {
          not method GET
      }
      root * /srv/ssftp
      route @notget {
          basicauth {
              bob $2y$10$f/asdasd.asdsadasd.asdasdasd
          }
          webdav
     }
     file_server browse
  }
  
```

The integrated LetsEncrypt support makes life so much easier than a comparable setup with apache or nginx.

frankjr · 2 years ago
Caddy is great and to my surprise it's actually very competitive with nginx in terms of performance, sometimes even faster.

https://blog.tjll.net/reverse-proxy-hot-dog-eating-contest-c...

https://news.ycombinator.com/item?id=32865497

zoidb · 2 years ago
Caddy is great and it's configuration is such a breath of fresh air compared to other web servers. As a little self plug I wrote about some cool things you can do with only using caddy config https://jarv.org/posts/cool-caddy-config-tricks/
RandomWorker · 2 years ago
I’m so confused by these things, setting up a Linux box with nginx isn’t that hard. It takes maybe a day to do, and while doing it you really understand better how your server works. The first time might take you 5 days to go through some tutorials, but generally after that it’s less than 1 day of work.

For me personally I really want to know what is going on in each folder and keep track of new folders, files etc. It’s maybe my paranoia of hacking. Context; when I was a kid I hacked so many things and knowing where the files are kept and hiding them is a key part of hacking. Therefore it’s always been a priority for me to check in regularly see what’s happening.

amanzi · 2 years ago
The main benefit for me is the integrated SSL certificate generation without needing to configure separate certificate infrastructure or Letsencrypt/acme. Also, Caddy implements a number of best practices by default without needing to specifically configure them, e.g. redirecting HTTP to HTTPS.

I do still manage a couple of fairly complex Nginx configurations, and I don't really see any benefit to retrofitting Caddy into that kind of scenario. But for a new deployment, I'll almost always reach for Caddy in the first instance.

mholt · 2 years ago
Yes! The best part of:

> without needing to configure separate certificate infrastructure or Letsencrypt/acme.

is not only that your deployment is simpler, it also scales better and is more robust to failures. It can tolerate external factors more robustly.

k_bx · 2 years ago
Installing Docker to run a web server is crazy to me.
amanzi · 2 years ago
Seems unnecessary to me - I would only consider running Caddy in Docker if the web application it was serving was also in Docker. Installing Caddy without Docker is pretty straight-forward - I have a basic Ansible playbook that does this with just 5 tasks.
francislavoie · 2 years ago
Yep, I agree, only need to run Caddy in Docker if you're planning to use Docker for things Caddy will serve.

Our docs cover many installation methods, most commonly used is our apt or rpm repos, which run Caddy as a systemd service. See https://caddyserver.com/docs/install

Rebelgecko · 2 years ago
Oke thing I really like about caddy is that it's super easy to use it to expose a bunch of docker-compose services to the Internet, with HTTPS, compression, and all that jazz. It helps avoid weird stuff I've ran into with other web servers like "oh, this nginx feature requires you import some random dudes packages because the official version doesn't enable it, and if the random dude and the official package versions ever diverge everything breaks"
account-5 · 2 years ago
I'm a beginner, but clearly too much of a beginner for this beginner guide. Went to it expecting a guide on how to set up a caddy webserver, spent most of the time reading about how to use docker. I just want to be able to set up a server to server html/CSS/JavaScript easily, and securely. Not edit yaml files and run containers locally.
avtar · 2 years ago
The Caddy project has a section in their docs for serving static assets:

https://caddyserver.com/docs/quick-starts/static-files

rob-olmos · 2 years ago
Recent question I haven't look much into yet: Is there a way to limit the number of simultaneous http2/3 streams from an IP address with Caddy?
mholt · 2 years ago
You can rate limit HTTP requests (agnostic of specific HTTP versions): https://github.com/mholt/caddy-ratelimit