From e590d29117c7e604a6866f1db2981f8a35b6dfaf Mon Sep 17 00:00:00 2001 From: Aaron Paterson <9441877+MayCXC@users.noreply.github.com> Date: Thu, 10 Oct 2024 00:06:46 -0400 Subject: [PATCH] Update bind.md --- .../markdown/caddyfile/directives/bind.md | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/docs/markdown/caddyfile/directives/bind.md b/src/docs/markdown/caddyfile/directives/bind.md index 151ed05..f8fa151 100644 --- a/src/docs/markdown/caddyfile/directives/bind.md +++ b/src/docs/markdown/caddyfile/directives/bind.md @@ -16,10 +16,13 @@ Note that binding sites inconsistently may result in unintended consequences. Fo ## Syntax ```caddy-d -bind +bind { + protocols ... +} ``` - **<hosts...>** is the list of host interfaces to bind which to bind the listener. +- **<protocols...>** is an optional override of the HTTP protocols to enable for the listener. ## Examples @@ -64,6 +67,39 @@ example.com { } ``` +To bind to a Unix domain socket at `/run/caddy/stream.sock` that serves h1 and h2, and another at `/run/caddy/dgram.sock` that serves h3: + +```caddy +example.com { + bind unix//run/caddy/stream.sock { + protocols h1 h2 + } + bind unixgram//run/caddy/dgram.sock { + protocols h3 + } +} +``` + +To bind to inherited descriptors specified with [environment placeholders](/docs/conventions#placeholders): + +```caddy +http://example.com { + bind fd/{env.CADDY_HTTP_FD} { + protocols h1 + } + redir https://example.com{uri} permanent +} + +https://example.com { + bind fd/{env.CADDY_HTTPS_FD} { + protocols h1 h2 + } + bind fdgram/{env.CADDY_HTTP3_FD} { + protocols h3 + } +} +``` + To bind one domain to two different interfaces, with different responses: ```caddy