diff --git a/src/docs/markdown/caddyfile/concepts.md b/src/docs/markdown/caddyfile/concepts.md index c59504c..9023001 100644 --- a/src/docs/markdown/caddyfile/concepts.md +++ b/src/docs/markdown/caddyfile/concepts.md @@ -277,17 +277,20 @@ reverse_proxy @post localhost:9000 You can use any [Caddy placeholders](/docs/conventions#placeholders) in the Caddyfile, but for convenience you can also use some equivalent shorthand ones: -| Shorthand | Replaces | -|--------------|---------------------------------| -| `{dir}` | `{http.request.uri.path.dir}` | -| `{file}` | `{http.request.uri.path.file}` | -| `{host}` | `{http.request.host}` | -| `{hostport}` | `{http.request.hostport}` | -| `{method}` | `{http.request.method}` | -| `{path}` | `{http.request.uri.path}` | -| `{query}` | `{http.request.uri.query}` | -| `{scheme}` | `{http.request.scheme}` | -| `{uri}` | `{http.request.uri}` | +| Shorthand | Replaces | +|-----------------|---------------------------------| +| `{dir}` | `{http.request.uri.path.dir}` | +| `{file}` | `{http.request.uri.path.file}` | +| `{host}` | `{http.request.host}` | +| `{hostport}` | `{http.request.hostport}` | +| `{method}` | `{http.request.method}` | +| `{path}` | `{http.request.uri.path}` | +| `{query}` | `{http.request.uri.query}` | +| `{remote}` | `{http.request.remote}` | +| `{remote_host}` | `{http.request.remote.host}` | +| `{remote_port}` | `{http.request.remote.port}` | +| `{scheme}` | `{http.request.scheme}` | +| `{uri}` | `{http.request.uri}` | diff --git a/src/docs/markdown/caddyfile/directives/reverse_proxy.md b/src/docs/markdown/caddyfile/directives/reverse_proxy.md index 6b07624..19b1b60 100644 --- a/src/docs/markdown/caddyfile/directives/reverse_proxy.md +++ b/src/docs/markdown/caddyfile/directives/reverse_proxy.md @@ -163,3 +163,14 @@ reverse_proxy /api/* node1:80 node2:80 node3:80 { lb_policy header X-My-Header } ``` + +Preserve original request Host and add common proxying headers: + +``` +reverse_proxy localhost:9000 { + header_up Host {host} + header_up X-Real-IP {remote_host} + header_up X-Forwarded-For {remote_host} + header_up X-Forwarded-Proto {scheme} +} +``` diff --git a/src/docs/markdown/caddyfile/directives/root.md b/src/docs/markdown/caddyfile/directives/root.md index e6f1cc4..1ee21b6 100644 --- a/src/docs/markdown/caddyfile/directives/root.md +++ b/src/docs/markdown/caddyfile/directives/root.md @@ -6,7 +6,7 @@ title: root (Caddyfile directive) Sets the root path of the site, used by various matchers and directives that access the file system. If unset, the default site root is the current working directory. -Specifically, this directive sets the `{http.vars.root}` placeholder. +Specifically, this directive sets the `{http.vars.root}` placeholder. It is mutually exclusive to other `root` directives in the same block, so it is safe to define multiple roots with matchers that intersect: they will not cascade and overwrite each other. ## Syntax