mirror of
https://github.com/caddyserver/website.git
synced 2025-04-21 20:46:15 -04:00
Docs for v2.6.3 (#296)
This commit is contained in:
parent
24d9769d61
commit
7c99a9ab17
7 changed files with 87 additions and 23 deletions
|
@ -14,13 +14,21 @@ This directive is a special case: it is evaluated before the structure is parsed
|
|||
import <pattern> [<args...>]
|
||||
```
|
||||
|
||||
- **<pattern>** is the filename, glob pattern, or name of [snippet](/docs/caddyfile/concepts#snippets) to include. Its contents will replace this line as if that file's contents appeared here to begin with. It is an error if a specific file cannot be found, but an empty glob pattern is not an error. If the pattern is a filename or glob, it is always relative to the file the `import` appears in.
|
||||
- **<pattern>** is the filename, glob pattern, or name of [snippet](/docs/caddyfile/concepts#snippets) to include. Its contents will replace this line as if that file's contents appeared here to begin with.
|
||||
|
||||
It is an error if a specific file cannot be found, but an empty glob pattern is not an error.
|
||||
|
||||
If importing a specific file, a warning will be emitted if the file is empty.
|
||||
|
||||
If the pattern is a filename or glob, it is always relative to the file the `import` appears in.
|
||||
|
||||
If using a glob pattern `*` as the final path segment, hidden files (i.e. files starting with a `.`) are ignored. To import hidden files, use `.*` as the final segment.
|
||||
- **<args...>** is an optional list of arguments to pass to the imported tokens. They can be used with a placeholder of the form `{args.N}` where `N` is the 0-based positional index of the parameter. This placeholder is a special case and is evaluated at parse-time, not run-time.
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
Import all files in an adjacent sites-enabled folder:
|
||||
Import all files in an adjacent sites-enabled folder (except hidden files):
|
||||
|
||||
```caddy-d
|
||||
import sites-enabled/*
|
||||
|
|
|
@ -390,11 +390,11 @@ By default, Caddy passes thru incoming headers—including `Host`—to t
|
|||
- It sets the [`X-Forwarded-Proto`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto) header field.
|
||||
- It sets the [`X-Forwarded-Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host) header field.
|
||||
|
||||
<span id="trusted_proxies"/> For these `X-Forwarded-*` headers, by default, Caddy will ignore their values from incoming requests, to prevent spoofing. If Caddy is not the first server being connected to by your clients (for example when a CDN is in front of Caddy), you may configure `trusted_proxies` with a list of IP ranges (CIDRs) from which incoming requests are trusted to have sent good values for these headers. As a shortcut, `private_ranges` may be configured to trust all private IP ranges.
|
||||
<span id="trusted_proxies"/> For these `X-Forwarded-*` headers, by default, the proxy will ignore their values from incoming requests, to prevent spoofing.
|
||||
|
||||
```caddy-d
|
||||
trusted_proxies private_ranges
|
||||
```
|
||||
If Caddy is not the first server being connected to by your clients (for example when a CDN is in front of Caddy), you may configure `trusted_proxies` with a list of IP ranges (CIDRs) from which incoming requests are trusted to have sent good values for these headers.
|
||||
|
||||
It is recommended that you configure this via the [`servers > trusted_proxies` global option](/docs/caddyfile/options#trusted_proxies) so that this applies to all proxy handlers in your server, without repetition.
|
||||
|
||||
<aside class="tip">
|
||||
|
||||
|
@ -402,7 +402,8 @@ If you're using Cloudflare in front of Caddy, be aware that you may be vulnerabl
|
|||
|
||||
</aside>
|
||||
|
||||
Additionally, when using the [`http` transport](#the-http-transport), the `Accept-Encoding: gzip` header will be set, if it is missing in the request from the client. This behavior can be disabled with [`compression off`](#compression) on the transport.
|
||||
Additionally, when using the [`http` transport](#the-http-transport), the `Accept-Encoding: gzip` header will be set, if it is missing in the request from the client. This allows the upstream to serve compressed content if it can. This behavior can be disabled with [`compression off`](#compression) on the transport.
|
||||
|
||||
|
||||
#### HTTPS
|
||||
|
||||
|
@ -678,15 +679,6 @@ handle_path /old-prefix/* {
|
|||
```
|
||||
|
||||
|
||||
When Caddy is behind another proxy or load balancer whose IP is `123.123.123.123`, which may set `X-Forwarded-*` headers to identify details about the original client request, that downstream proxy must be listed as trusted, otherwise Caddy will ignore those incoming headers:
|
||||
|
||||
```caddy-d
|
||||
reverse_proxy localhost:8080 {
|
||||
trusted_proxies 123.123.123.123
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
X-Accel-Redirect support, i.e. serving static files as requested by the proxy upstream:
|
||||
|
||||
```caddy-d
|
||||
|
|
|
@ -31,6 +31,9 @@ tls [internal|<email>] | [<cert_file> <key_file>] {
|
|||
ca_root <pem_file>
|
||||
key_type ed25519|p256|p384|rsa2048|rsa4096
|
||||
dns <provider_name> [<params...>]
|
||||
propagation_timeout <duration>
|
||||
propagation_delay <duration>
|
||||
dns_ttl <duration>
|
||||
dns_challenge_override_domain <domain>
|
||||
resolvers <dns_servers...>
|
||||
eab <key_id> <mac_key>
|
||||
|
@ -95,6 +98,12 @@ tls [internal|<email>] | [<cert_file> <key_file>] {
|
|||
|
||||
- **dns** <span id="dns"/> enables the [DNS challenge](/docs/automatic-https#dns-challenge) using the specified provider plugin, which must be plugged in from one of the [`caddy-dns`](https://github.com/caddy-dns) repositories. Each provider plugin may have their own syntax following their name; refer to their docs for details. Maintaining support for each DNS provider is a community effort. [Learn how to enable the DNS challenge for your provider at our wiki.](https://caddy.community/t/how-to-use-dns-provider-modules-in-caddy-2/8148)
|
||||
|
||||
- **propagation_timeout** <span id="propagation_timeout"/> is a [duration value](/docs/conventions#durations) that sets the maximum time to wait for the DNS TXT records to appear when using the DNS challenge. Set to `-1` to disable propagation checks. Default 2 minutes.
|
||||
|
||||
- **propagation_delay** <span id="propagation_delay"/> is a [duration value](/docs/conventions#durations) that sets how long to wait before starting DNS TXT records propagation checks when using the DNS challenge. Default 0 (no wait).
|
||||
|
||||
- **dns_ttl** <span id="dns_ttl"/> is a [duration value](/docs/conventions#durations) that sets the TTL of the TXT record used for the DNS challenge.
|
||||
|
||||
- **dns_challenge_override_domain** <span id="dns_challenge_override_domain"/> overrides the domain to use for the DNS challenge. This is to delegate the challenge to a different domain, e.g. one whose DNS provider has a [`caddy-dns`](https://github.com/caddy-dns) plugin.
|
||||
|
||||
- **resolvers** <span id="resolvers"/> customizes the DNS resolvers used when performing the DNS challenge; these take precedence over system resolvers or any default ones. If set here, the resolvers will propagate to all configured certificate issuers.
|
||||
|
@ -154,7 +163,9 @@ Obtains certificates using the ACME protocol.
|
|||
trusted_roots <pem_files...>
|
||||
dns <provider_name> [<options>]
|
||||
propagation_timeout <duration>
|
||||
propagation_delay <duration>
|
||||
propagation_delay <duration>
|
||||
dns_ttl <duration>
|
||||
dns_challenge_override_domain <domain>
|
||||
resolvers <dns_servers...>
|
||||
preferred_chains [smallest] {
|
||||
root_common_name <common_names...>
|
||||
|
@ -189,6 +200,10 @@ Obtains certificates using the ACME protocol.
|
|||
|
||||
- **propagation_delay** <span id="propagation_delay"/> is a [duration value](/docs/conventions#durations) that sets how long to wait before starting DNS TXT records propagation checks when using the DNS challenge. Default 0 (no wait).
|
||||
|
||||
- **dns_ttl** <span id="dns_ttl"/> is a [duration value](/docs/conventions#durations) that sets the TTL of the TXT record used for the DNS challenge.
|
||||
|
||||
- **dns_challenge_override_domain** <span id="dns_challenge_override_domain"/> overrides the domain to use for the DNS challenge. This is to delegate the challenge to a different domain, e.g. one whose DNS provider has a [`caddy-dns`](https://github.com/caddy-dns) plugin.
|
||||
|
||||
- **resolvers** <span id="resolvers"/> customizes the DNS resolvers used when performing the DNS challenge; these take precedence over system resolvers or any default ones.
|
||||
|
||||
- **preferred_chains** <span id="preferred_chains"/> specifies which certificate chains Caddy should prefer; useful if your CA provides multiple chains. Use one of the following options:
|
||||
|
|
|
@ -20,7 +20,9 @@ tracing {
|
|||
}
|
||||
```
|
||||
|
||||
- **<span_name>** - is a span name. Please see span naming [guidelines](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/specification/trace/api.md).
|
||||
- **<span_name>** is a span name. Please see span [naming guidelines](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.7.0/specification/trace/api.md).
|
||||
|
||||
[Placeholders](/docs/caddyfile/concepts#placeholders) may be used in span names; keep in mind that tracing happens as early as possible, so only request placeholders may be used, and not response placeholders.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
@ -43,10 +45,10 @@ export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://my-otlp-endpoint:55680
|
|||
|
||||
Here is a **Caddyfile** example:
|
||||
|
||||
```
|
||||
handle /myHandler {
|
||||
```caddy-d
|
||||
handle /example* {
|
||||
tracing {
|
||||
span my-span
|
||||
span example
|
||||
}
|
||||
reverse_proxy 127.0.0.1:8081
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue