HTTP3.md: update Caddy example

Closes #9623
This commit is contained in:
Matt Holt 2022-09-29 12:42:00 -06:00 committed by Daniel Stenberg
parent bbdeb4c673
commit 16a3ed4038
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -291,26 +291,21 @@ that exists in curl's test dir.
### Caddy
[Install Caddy](https://caddyserver.com/docs/install), you can even put the
single binary in a separate directory if you prefer.
[Install Caddy](https://caddyserver.com/docs/install). For easiest use, the binary
should be either in your PATH or your current directory.
In the same directory you put Caddy, create a `Caddyfile` with the following
content to run an HTTP/3 reverse-proxy on port 7443:
Create a `Caddyfile` with the following content:
~~~
{
auto_https disable_redirects
servers :7443 {
protocol {
experimental_http3
}
}
}
localhost:7443 {
reverse_proxy localhost:80
respond "Hello, world! You're using {http.request.proto}"
}
~~~
Then run Caddy:
./caddy start
Making requests to `https://localhost:7443` should tell you which protocol is being used.
You can change the hard-coded response to something more useful by replacing `respond`
with `reverse_proxy` or `file_server`, for example: `reverse_proxy localhost:80`