From 9daa0fa33126c477903a0bcee9477be6b9388410 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 8 Jun 2020 16:32:57 -0600 Subject: [PATCH] docs: A few minor changes --- .../caddyfile/directives/acme_server.md | 2 +- .../markdown/caddyfile/directives/basicauth.md | 2 +- .../markdown/caddyfile/directives/import.md | 17 ++++++++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/docs/markdown/caddyfile/directives/acme_server.md b/src/docs/markdown/caddyfile/directives/acme_server.md index 7e5aaf1..e46a766 100644 --- a/src/docs/markdown/caddyfile/directives/acme_server.md +++ b/src/docs/markdown/caddyfile/directives/acme_server.md @@ -11,7 +11,7 @@ When enabled, requests matching the path `/acme/*` will be handled by the ACME s ## Client configuration -Using ACME server defaults, ACME clients should simply be configured to use `https://localhost/acme/directory` as their ACME endpoint. +Using ACME server defaults, ACME clients should simply be configured to use `https://localhost/acme/local/directory` as their ACME endpoint. (`local` is the name of Caddy's default CA.) ## Syntax diff --git a/src/docs/markdown/caddyfile/directives/basicauth.md b/src/docs/markdown/caddyfile/directives/basicauth.md index 059d158..4418f55 100644 --- a/src/docs/markdown/caddyfile/directives/basicauth.md +++ b/src/docs/markdown/caddyfile/directives/basicauth.md @@ -8,7 +8,7 @@ Enables HTTP Basic Authentication, which can be used to protect directories and **Note that basic auth is not secure over plain HTTP.** Use discretion when deciding what to protect with HTTP Basic Authentication. -When a user requests a resource that is protected, the browser will prompt the user for a username and password if they have not almdy supplied one. If the proper credentials are present in the Authorization header, the server will grant access to the resource. If the header is missing or the credentials are incorrect, the server will respond with HTTP 401 Unauthorized. +When a user requests a resource that is protected, the browser will prompt the user for a username and password if they have not already supplied one. If the proper credentials are present in the Authorization header, the server will grant access to the resource. If the header is missing or the credentials are incorrect, the server will respond with HTTP 401 Unauthorized. Caddy configuration does not accept plaintext passwords; you MUST hash them before putting them into the configuration. The [`caddy hash-password`](/docs/command-line#caddy-hash-password) command can help with this. diff --git a/src/docs/markdown/caddyfile/directives/import.md b/src/docs/markdown/caddyfile/directives/import.md index 956c947..da9be92 100644 --- a/src/docs/markdown/caddyfile/directives/import.md +++ b/src/docs/markdown/caddyfile/directives/import.md @@ -11,10 +11,11 @@ This directive is a special case: it is evaluated before the structure is parsed ## Syntax ```caddy-d -import +import [] ``` - **<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. +- **<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 @@ -24,3 +25,17 @@ Import all files in an adjacent sites-enabled folder: ```caddy-d import sites-enabled/* ``` + +Import a snippet that sets CORS headers using an import argument: + +```caddy +(cors) { + @origin header Origin {args.0} + header @origin Access-Control-Allow-Origin "{args.0}" + header @origin Access-Control-Request-Method GET +} + +example.com { + import cors example.com +} +``` \ No newline at end of file