Sandbox99 Chronicles

Caddy: The Modern Web Server You Need to Know

Caddy

Written by Jose Mendez

Hi, I’m Jose Mendez, the creator of sandbox99.cc. with a passion for technology and a hands-on approach to learning, I’ve spent more than fifteen years navigating the ever-evolving world of IT.

Published Jun 21, 2025 | Last updated on Jun 24, 2025 at 12:16AM

Reading Time: 4 minutes

The Shifting Landscape of Web Servers

For years, a few titans have dominated the web server landscape. Names like Nginx, Apache2, and Microsoft IIS have been synonymous with hosting websites and applications, powering the vast majority of the internet. Their robust features, extensive documentation, and large communities have made them the go-to choices for developers and system administrators worldwide. However, a new contender has been steadily gaining traction, offering a fresh, modern approach to web serving: Caddy.

In the realm of self-hosting, where individuals and small teams manage their own infrastructure, Caddy has found a particularly warm reception. Its focus on simplicity and automatic HTTPS management has made it a favorite, often competing directly with established reverse proxy solutions like Traefik and Nginx Proxy Manager. While these competitors excel in their own right, Caddy carves out a niche with its unparalleled ease of use and “secure by default” philosophy.

My Journey with Caddy

I’ve been using Caddy for over three years now, and I can confidently say it has revolutionized how I approach web serving and reverse proxying for my personal projects and this very blog site you’re reading. Its elegant design and powerful defaults have saved me countless hours of configuration headaches, especially when it comes to SSL certificates. Let’s delve into the fundamentals of Caddy and understand what makes it such a compelling choice.

This screenshot below demonstrates the blog site successfully being served through Caddy.

Caddy Fundamentals

At its heart, Caddy is designed for simplicity. Unlike its more verbose counterparts, Caddy’s configuration, typically handled through the “Caddyfile,” is remarkably intuitive and human-readable. It prioritizes common use cases, making it incredibly easy to set up basic web serving, reverse proxies, and, most notably, automatic HTTPS.

Automatic HTTPS: This is arguably Caddy’s most celebrated feature. Caddy automatically obtains, renews, and manages SSL/TLS certificates for your domains using services like Let’s Encrypt or ZeroSSL. This means no more manual certificate generation, renewal scripts, or worrying about expired certificates. For anyone who has wrestled with certbot or similar tools, Caddy’s “just works” approach to HTTPS is a game-changer.

Serving Static Files: Caddy can effortlessly serve static files (HTML, CSS, JavaScript, images, etc.) with minimal configuration. A simple file_server directive in your Caddyfile is often all you need.

Reverse Proxy Capabilities: Caddy excels as a reverse proxy, forwarding incoming requests to backend applications or services. This is crucial for modern web architectures, especially when dealing with microservices or containerized applications. Its reverse_proxy directive is straightforward, allowing you to quickly direct traffic to your internal services. Caddy also includes built-in load balancing, health checks, and other features essential for robust proxying.

HTTP/3 and QUIC Support: Caddy is at the forefront of web technology, offering out-of-the-box support for HTTP/3 and QUIC. These next-generation protocols provide significant performance improvements, especially for users on less stable networks, leading to faster loading times and a better user experience.

Running Caddy: Docker vs. Host Level

When deploying Caddy, you generally have two primary options: running it directly on the host system or deploying it as a Docker container. Both have their advantages and disadvantages:

Running Caddy on the Host Level:


  • Advantages:
    • Simpler for beginners: For those new to containerization, directly installing and running Caddy on your operating system (e.g., Linux, Windows) can feel more familiar and easier to grasp initially.
    • Direct resource access: Caddy has direct access to host resources, which can sometimes result in slightly better performance in specific scenarios where network overhead from Docker is a factor.
    • Less overhead: No Docker daemon or container runtime overhead.
  • Disadvantages:
    • Dependency management: You are responsible for managing Caddy’s dependencies and ensuring it doesn’t conflict with other software on your host.
    • Less isolation: If Caddy is compromised, it could potentially have broader access to your host system’s resources compared to a containerized setup.
    • Port conflicts: You need to carefully manage port allocations to avoid conflicts with other services on your host.

Running Caddy in Docker:


  • Advantages:
    • Isolation and Security: Docker containers provide excellent isolation, sandboxing Caddy and its dependencies from the host system. This enhances security by limiting the blast radius of any potential vulnerabilities.
    • Portability: Docker images are highly portable. You can easily move your Caddy configuration and deployment from one server to another, ensuring consistent environments.
    • Simplified dependency management: All Caddy’s dependencies are bundled within the container, eliminating “dependency hell” on your host system.
    • Version control and rollbacks: Docker allows for easy versioning of your Caddy deployments, enabling quick rollbacks to previous working states if issues arise.
    • Integration with container orchestration: For more complex setups, Caddy integrates seamlessly with container orchestration platforms like Docker Compose and Kubernetes.
    • Dynamic configuration (with tools like caddy-docker-proxy): While not built-in, tools like caddy-docker-proxy can dynamically generate Caddy configurations based on Docker labels, making it incredibly powerful for microservice environments.
  • Disadvantages:
    • Learning curve: Docker introduces an additional layer of complexity, requiring an understanding of Docker concepts (images, containers, volumes, networks).
    • Network configuration: Setting up Docker networks for Caddy to communicate with other containers can sometimes be a bit more involved, though well-documented.
    • Debugging can be trickier: Troubleshooting issues within a containerized environment can sometimes be less straightforward than on a host directly.

For this blog site, I’ve opted for a Dockerized Caddy setup. This provides the ideal balance of isolation, portability, and ease of management, allowing me to focus on content creation rather than intricate server configurations.

Final Thoughts

By reading this article, you’ve gained a fundamental understanding of Caddy’s core strengths and how it stacks up against traditional web servers and popular reverse proxy solutions. You’ve also explored the practical considerations of deploying Caddy, whether directly on your host or within a Docker container.

My hope is that this overview has piqued your interest in Caddy. Its elegant design, focus on automation, and commitment to modern web standards make it a compelling choice for anyone looking to simplify their web serving infrastructure, especially within the self-hosting community. The insights you’ve gained here will empower you to confidently explore Caddy further, whether it’s setting up your first static site or reverse proxying a complex application, all while enjoying the peace of mind that comes with automatic HTTPS. Happy serving!

Further Reading

To deepen your knowledge and see Caddy in action, I highly recommend exploring additional resources.

For more in-depth information and recent articles, please check out the following:

  • YouTube Tutorials: Many creators provide excellent visual guides and comparisons. Consider searching for terms like “Caddy setup tutorial,” “Caddy installation guide,” “Caddy vs Traefik,” and “Caddy vs Nginx Proxy Manager.” Watching practical demonstrations can provide invaluable insights and help you get started even faster. started even faster.
  • Official Caddy Documentation: This is the definitive source for all things Caddy, from basic setup to advanced configurations. https://caddyserver.com/docs/
  • Beyond the Basics: Advanced Caddy www Domain Configuration

Related Post

Docker & Docker Compose Cheatsheet

Docker & Docker Compose Cheatsheet

Introduction to Docker In the world of software development, the phrase "it works on my machine" used to be a common, frustrating refrain. This is precisely the problem Docker set out to solve. Introduced in 2013, Docker has revolutionized how applications are built,...

read more