mirror of
https://github.com/caddyserver/website.git
synced 2025-04-26 23:16:16 -04:00
Update docs for 2.6
This commit is contained in:
parent
c67668615e
commit
2ab3061111
12 changed files with 158 additions and 78 deletions
|
@ -6,6 +6,8 @@ title: respond (Caddyfile directive)
|
|||
|
||||
Writes a hard-coded/static response to the client.
|
||||
|
||||
If the body is non-empty, this directive sets the `Content-Type` header if it is not already set. The default value is `text/plain; utf-8` unless the body is a valid JSON object or array, in which case it is set to `application/json`. For all other types of content, set the proper Content-Type explicitly using the [`header` directive](/docs/caddyfile/directives/header).
|
||||
|
||||
|
||||
## Syntax
|
||||
|
||||
|
@ -16,7 +18,7 @@ respond [<matcher>] <status>|<body> [<status>] {
|
|||
}
|
||||
```
|
||||
|
||||
- **<status>** is the HTTP status code to write. Default 200.
|
||||
- **<status>** is the HTTP status code to write. If 103 (Early Hints), the response will be written without a body and the handler chain will continue. (HTTP 1xx responses are informational, not final.) Default: 200.
|
||||
- **<body>** is the response body to write.
|
||||
- **body** is an alternate way to provide a body; convenient if it is multiple lines.
|
||||
- **close** will close the client's connection to the server after writing the response.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue