Common mistakes with Caddy for self-hosters replacing Nginx and Apache
Self-hosters transitioning to Caddy often encounter port 80 validation failures and subdirectory proxy issues. Performance discrepancies also arise because Caddy defaults to keepalive for reverse proxies while Nginx requires manual configuration to achieve similar speeds.
The Port 80 Trap and Subdirectory Issues
Caddy automates TLS certificate management through Let’s Encrypt. This automation requires port 80 to be accessible for the ACME provider to complete validation. If you attempt to block port 80 at the firewall level to prevent HTTP traffic, Caddy will fail the certificate maintenance routine. You must run Caddy with the -disable-http-challenge flag to prevent this failure when you block port 80. Users also make mistakes when they try to proxy services through subdirectories. Users who attempt to host services through subdirectories like domain.com/hassio often find that the interface fails to load correctly, which forces a transition to using subdomains like assistant.domain.com to ensure the reverse proxy functions as intended. A user attempting to host Nextcloud and Home Assistant through domain.com/nextcloud and domain.com/hassio experienced this exact failure. This error is frustrating for those moving away from Apache. Unlike OpenLiteSpeed, which requires a server restart to process .htaccess changes, Caddy uses a configuration syntax designed to reduce complexity. While Nginx offers significant flexibility for URL rewriting and access control, Caddy’s straightforward syntax is its primary draw for developers. The Caddyfile uses a much simpler structure than the Nginx configuration.
Backend Performance and the Keepalive Difference
Performance issues often emerge when users enable TLS. One tester reported download speeds of 9500 when using HTTP but saw those speeds drop to 5400 when using HTTPS in a Docker environment. This performance gap often leads to the incorrect conclusion that Caddy is inherently slower than Nginx. In reality, the discrepancy often stems from how each server handles backend connections. Caddy defaults to using keepalive for its reverse proxy. Nginx does not default to keepalive for upstream connections. You have to add an upstream block and include a keepalive directive to make Nginx perform similarly.
| Server | Type | Performance | Static Content |
|---|---|---|---|
| Apache | Process-driven | Moderate | Good |
| NGINX | Event-driven | High | Excellent |
| Caddy | Event-driven | High | Excellent |
| LiteSpeed | Event-driven | High | Excellent |
If you already manage a VPS, you know how much time Nginx configuration consumes. Nginx users must explicitly define the upstream with a keepalive value and use proxy_http_version 1.1 to achieve similar results. A specific Nginx configuration to enable keepalive includes an upstream block with server 127.0.0.1:8080; and a keepalive 16; directive, followed by a server block that uses proxy_http_version 1.1; and proxy_set_header Connection "";. A user testing the performance of Caddy versus Nginx reported that Caddy outperformed Nginx by four times in certain concurrent request scenarios, but this difference exists because Caddy defaults to keepalive while NGINX does not.
Feature Gaps in Production Environments
Caddy prioritizes simplicity, but this comes at the cost of advanced control. Nginx provides highly mature load-balancing capabilities such as round-robin, least connections, IP hash, and weighted configurations. Caddy’s reverse_proxy directive supports multiple upstream servers, health checks, and retries, but it lacks the depth of Nginx for complex traffic policies. Nginx can handle static files, reverse proxying, caching, access control, URL rewriting, FastCGI, and gRPC. Nginx also keeps several features behind a paywall, such as healthcheck-based load-balancing, which requires a paid version. Caddy provides many of these features for free. Caddy is a poor choice for large production environments that require the sophisticated load-balancing and routing rules Nginx provides. For developers deploying .NET, Node.js, or Go applications, Caddy is a modern choice, but it cannot replace the massive ecosystem and flexibility of Nginx for complex infrastructure. Nginx remains the industry standard for managing high-traffic websites and large application clusters. Will Caddy eventually bridge the feature gap for enterprise users?