Caddy (web server): Difference between revisions
Appearance
	
	
| No edit summary | No edit summary | ||
| Line 5: | Line 5: | ||
| Advantages of Caddy: | Advantages of Caddy: | ||
| * Much simpler configuration | * Much simpler configuration with sane defaults (e.g. no directory listing). | ||
| * Automatic HTTPS (redirect, public certificates, self-signed certificates) | * Automatic HTTPS (redirect, public certificates, self-signed certificates) | ||
| * Automatic HTTP/2 | * Automatic HTTP/2 | ||
| Line 14: | Line 14: | ||
| ==Caddyfile== | ==Caddyfile== | ||
| ===Reverse Proxy=== | |||
| Just use the [https://caddyserver.com/docs/caddyfile/directives/reverse_proxy reverse_proxy] directive.   | |||
| By default, this will automatically preserve headers.   | |||
| Things like websockets will work automatically. | |||
| <pre> | |||
| gitlab.example.com { | |||
|   encode zstd gzip | |||
|   reverse_proxy localhost:8001 | |||
| } | |||
| </pre> | |||
| ===HTTP3=== | ===HTTP3=== | ||
Revision as of 14:26, 28 January 2021
Caddy is a webserver which is much simpler to configure than Apache and is supposedly just as fast. It handles HTTPS automatically.
Advantages of Caddy:
- Much simpler configuration with sane defaults (e.g. no directory listing).
- Automatic HTTPS (redirect, public certificates, self-signed certificates)
- Automatic HTTP/2
This article is about Caddy v2.
Note that caddy does not support .htaccess which is only supported in Apache.
Caddyfile
Reverse Proxy
Just use the reverse_proxy directive.
By default, this will automatically preserve headers.
Things like websockets will work automatically.
gitlab.example.com {
  encode zstd gzip
  reverse_proxy localhost:8001
}
HTTP3
Add the following to your Caddyfile:
{ 
  servers {
    protocol {
      experimental_http3
    }
  }
}
