Caddy – The Ultimate Server with Automatic HTTPS
Caddy is an advanced open-source web server that automatically manages TLS certificates, supports dynamic provisioning, ensures compliance with security standards, and offers flexible configuration and extensibility for developers.
Read original articleCaddy is an advanced web server that automatically provisions and renews TLS certificates for all sites, ensuring secure HTTPS connections by default. It features On-Demand TLS, which allows for dynamic certificate management during TLS handshakes, making it ideal for SaaS applications. Caddy is designed to handle large-scale deployments, managing certificates for hundreds of thousands of sites efficiently. It supports compliance with PCI, HIPAA, and NIST standards, and can serve HTTPS even for localhost and internal IPs using a self-managed certificate authority. Caddy's architecture allows for flexible configuration through a JSON document or various other formats, and it includes a RESTful API for real-time configuration changes. The server is capable of proxying various protocols, including HTTP, WebSockets, and FastCGI, and offers high availability features such as load balancing and health checks. Caddy is open-source and relies on sponsorships for ongoing development, providing users with benefits like private support. Its modular design allows for easy extensibility, enabling developers to create plugins and customize functionality without bloating the codebase. Caddy is recognized for its security defaults and has been recommended by experts in the field.
- Caddy automatically manages TLS certificates for secure HTTPS connections.
- It supports dynamic certificate provisioning, ideal for SaaS applications.
- The server is designed for high scalability and compliance with security standards.
- Caddy offers flexible configuration options and a RESTful API for real-time changes.
- It is open-source and relies on sponsorships for continued development and support.
Related
Our Wandering Path to Supporting 1000s of Domain Names
FusionAuth Cloud now supports unlimited custom domains using Caddy for dynamic TLS certificate provisioning. This change enhances branding consistency and scalability, overcoming AWS constraints for a highly-available infrastructure with customization options.
Make Your Own CDN with NetBSD
The article outlines setting up a self-hosted CDN using NetBSD, Varnish, and nginx, detailing installation, SSL management, configuration, and benefits like control, device compatibility, and geo-replication options.
Coding on iPad using self-hosted VSCode, Caddy, and code-server
This guide explains setting up coding on an iPad using VSCode, code-server, and Tailscale for secure access, requiring an Ubuntu server and configuration adjustments for security and functionality.
Moving my website from Netlify to Caddy
Alex Chan migrated their website from Netlify to a Linux server using Caddy to reduce costs, achieving 1TB bandwidth for $5/month, with minimal downtime and improved control over configurations.
Caddy Ninja – Setup an HTTPS-Enabled Web Server with Caddy on Alpine Linux
The guide details setting up an HTTPS-enabled web server using Caddy on Alpine Linux, covering prerequisites, installation, configuration, security headers, error handling, and automatic Let's Encrypt certificate requests.
Throw a Caddy reverse proxy in front of your normal dev server and you immediately get HTTP2 via the root certificate it installs in your OS trust store. (https://caddyserver.com/docs/automatic-https)
We (ElectricSQL) recommend it for our users as our APIs do long polling, which with HTTP2 doesn't lock up those 6 concurrent connections.
I've also found that placing it in front of Vite for normal development makes reloads much faster. Vite uses the JS module system for loading individual files in the browser with support for HMR (hot module replacement), this can result in a lot of concurrent requests for larger apps, creating a queue for those files on the six connections. Other bundlers/build tools bundle the code during development, reducing the number of files loaded into the browser, this created a bit of a debate last year on which is the better approach. With HTTP2 via Caddy in front of Vite you solve all those problems!
Would recommend it for anyone wanting a better version of Nginx Proxy Manager. The documentation is a little lacking so far but the maintainers are very helpful in their Discord.
[0] github.com/fosrl/pangolin
I configured my kubernetes cluster to automatically create and renew certs a few years ago. It's all done through Ingress now. I just point my Nginx load balancer to my new domain and it figures it out.
I don't often need local https but when I do I also need outside access so Stripe or whatever can ping my dev server (testing webhooks). For that I have a server running Nginx which I use to proxy back to localhost, I just have to run 1 command to temporarily expose my machine under a fixed domain.
Works for me. Maybe not everyone but I'll keep doing this since I don't have any reason to switch
I no longer trust the authors to be honest about known shortcomings, let alone be upfront, truthful, and transparent when dealing with security issues and reported vulnerabilities.
I hope I’m wrong. Does anyone know how they’ve handled disclosures in the past?
Meaning ecosystems around Caddy to make it even simpler and more secure, e.g. keep your server private while serving Internet clients. So VPNs like Tailscale (1) or zero implicit trust like OpenZiti (also Apache v2; (2)). Similar to what we have seen with open source k8s ecosystem for example.
(1) https://tailscale.com/blog/caddy (and other VPNs but the proprietary bits in the commercial TS service make it easier to use)
(2) https://github.com/openziti-test-kitchen/ziti-caddy (disclosure: maintainer...there may be other open source zero implicit trust options with these types of Caddy integrations)
Especially for its HTTP/2 and HTTP/3 QUIC support.
Caddy is so awesome. I actually have a few other sites on the same server and updating my config is hella simple.
I spent several years optimizing my nginx setup and I haven't touched it in years (I was obsessed about getting a perfect security score).
Let's just say it takes a lot these days to choose something that is not nginx.
Nevertheless, I used Caddy to front our internal Mattermost chat server and it works flawlessly to date. The configuration was really simple, I like it a lot.
So easy to setup and performs very well.
- There's a great tool, localias, which uses Caddy for a local dev server https://github.com/peterldowns/localias
- I use it locally for dev https://github.com/iloveitaly/python-starter-template/blob/m... which aligns tricky bits of a web app like HTTP redirect, cookies, and CORS to work consistently across dev and prod.
- Can be used on GHA for HTTPS as well https://github.com/iloveitaly/github-action-localias
When I add set the IP of a domain to point to caddy, do I have do tell it some how to Caddy, or the certificate is created on the fly on the first https call?
It's really important for us https://news.ycombinator.com/item?id=43053955 due to our need to redirec apex domain to www ... which we can solve with the free (great) service provided by https://www.apextowww.com/#get-started ... but, we are just curious since https://www.apextowww.com/#get-started does use Caddy (I see it in their headers) so maybe we would just need Caddy :)
I heard about how Caddy did automatic https, and given the searing pain of doing https on Nginx, decided to make the switch.
Never regeretted it. Caddy it always up to the job even for sophisticated reverse proxying configs.
I have been using lighttpd for much of this. It's configuration is extremely simple although it has some quirks. It also has a few problems like not always correctly logging errors related to CGI, and not being able to proxy to a backend over SSL.
I tried caddy because of its simple configuration syntax and plugin support.
For caddy the sample webpage alone threw me off. It includes a bunch of CSS, custom fonts, and for whatever reason it has tilted text.
I'd like a test webpage to fit on my terminal screen when I SSH to it. Or at least not require a modern browser to render.
Anyway I just don't think Caddy fits my usecase. Are there no dead simple, lightweight alternatives to nginx and apache that actually work?
Seems to work great. We did run into a rate limiting issue with letsencrypt when we tried to provision too many certs at one time. Ended up having to use wildcard certs to decrease the number of requests. Hardly caddy's fault, though.
It really was pretty easy to setup and “just works”
Nginx:
rewrite ^/old/((\w|-)+) /new/$1.php;
Caddy: @oldPath {
path_regexp old ^/old/([\w-]+)
}
rewrite @oldPath /new/{re.old.1}.php
And many things are not even handled by Caddy, or fail silently (for example, we could not get NetData to reverse_proxy behind Caddy no matter what we tried, and the logs were completely useless.)But with Traefik, albeit more complicated, had tons more examples to work from, and a little help with LLMs to clean up my configs when complete just made it much easier in the long run.
I tried Caddy with caddy-docker-proxy and maybe that was my issue? I’m happy with Traefik but for a simple config I can definitely see the advantages of Caddy.
Are you using caddy-security? Or is there a better alternative?
Absolute stunner project.
I hate the config file though. It could be 10x safer / more discoverable / nicer to use by just using json with a schema that validates and shows docs in the tooltips similar to tsconfig.
I suspect my typescript lsp addiction and relatively limited (though non-zero) backend experience has spoiled my tolerance for the primal nature of backend tooling.
Why do I need to write a lot of code to say map example.com to 1.2.3.4?
I get there are headers etc, but in most cases, it should be just one line, with sane defaults. That’s what caddy does. Takes care of SSL automatically, and does the job with minimal code. If you have a special setup, there are options, and you can write more code to achieve that.
Does it allow to plug-in into this system so that post-renewal actions are possible, like distributing those certificates to other machines through Python scripts?
I wish it had more informative logs, though. Some subtle errors in Caddyfile may result in the server not communicating, and not telling you that something is wrong.
traffic sees dozen of security releases a year... and i always wonder if its less secure or is more secure because people do find the holes there.
I could ask a LLM but I'd prefer the old way for this type of stuff...
since when was hn for ads? there's nothing notably technical on the page
vllm serve ${MODEL_REPO} --dtype auto --api-key $HF_TOKEN --guided-decoding-backend outlines --disable-fastapi-docs &
sudo caddy reverse-proxy --from ${SUBDOMAIN}.sugaku.net --to localhost:8000 &
Related
Our Wandering Path to Supporting 1000s of Domain Names
FusionAuth Cloud now supports unlimited custom domains using Caddy for dynamic TLS certificate provisioning. This change enhances branding consistency and scalability, overcoming AWS constraints for a highly-available infrastructure with customization options.
Make Your Own CDN with NetBSD
The article outlines setting up a self-hosted CDN using NetBSD, Varnish, and nginx, detailing installation, SSL management, configuration, and benefits like control, device compatibility, and geo-replication options.
Coding on iPad using self-hosted VSCode, Caddy, and code-server
This guide explains setting up coding on an iPad using VSCode, code-server, and Tailscale for secure access, requiring an Ubuntu server and configuration adjustments for security and functionality.
Moving my website from Netlify to Caddy
Alex Chan migrated their website from Netlify to a Linux server using Caddy to reduce costs, achieving 1TB bandwidth for $5/month, with minimal downtime and improved control over configurations.
Caddy Ninja – Setup an HTTPS-Enabled Web Server with Caddy on Alpine Linux
The guide details setting up an HTTPS-enabled web server using Caddy on Alpine Linux, covering prerequisites, installation, configuration, security headers, error handling, and automatic Let's Encrypt certificate requests.