mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-31 04:05:46 -04:00
Content-Type clarifications
parent
f9066a0ae9
commit
06426a6c74
@ -200,18 +200,28 @@ Default address: `localhost:2019`
|
|||||||
|
|
||||||
## POST /load
|
## POST /load
|
||||||
|
|
||||||
Sets Caddy's configuration to the JSON body. The `Content-Type` header must indicate a JSON payload, e.g. `application/json`. Configuration changes are very lightweight and efficient.
|
Sets Caddy's configuration. The response blocks until the reload completes or fails. Configuration changes are lightweight, efficient, and incur zero downtime.
|
||||||
|
|
||||||
_Note for Enterprise users_: If you are using the `/config/` endpoint to modify configuration instead, you MUST NOT use `/load` because it lacks the capabilities for partial configuration changes.
|
The request's Content-Type header indiciates the config format provided in the request body. Usually, this should be `application/json` which represents Caddy's native config format. For another config format, specify the appropriate Content-Type so that the value after the forward slash `/` is the name of the config adapter to use. For example, when submitting a Caddyfile, use a value ending in `/caddyfile`; or for JSON 5, specify a value ending in `/json5`; etc.
|
||||||
|
|
||||||
|
_Note for Enterprise users_: If you use the `/config/` endpoint to modify configuration, you MUST NOT mix its use with `/load` because `/load` lacks the capabilities for partial configuration changes, and mixing their use could lead to inconsistent configuration states.
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl -X POST "http://localhost:2019/load" \
|
$ curl -X POST "http://localhost:2019/load" \
|
||||||
-H "Content-Type: application/json"
|
-H "Content-Type: application/json" \
|
||||||
-d @caddy.json
|
-d @caddy.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note:** curl's `-d` flag removes newlines, so if your config format is sensitive to line breaks (e.g. the Caddyfile), use `--data-binary` instead:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ curl -X POST "http://localhost:2019/load" \
|
||||||
|
-H "Content-Type: text/caddyfile" \
|
||||||
|
--data-binary @Caddyfile
|
||||||
|
```
|
||||||
|
|
||||||
## POST /stop
|
## POST /stop
|
||||||
|
|
||||||
Gracefully shuts down the server.
|
Gracefully shuts down the server.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user