caddy-respond(8)
caddy-respond - Simple, hard-coded HTTP responses for development and testing
Description
Caddy
NAME
caddy-respond - Simple, hard-coded HTTP responses for development and testing
SYNOPSIS
caddy respond [flags]
DESCRIPTION
Spins up a quick-and-clean HTTP server for development and testing purposes.
With no options specified, this command listens on a random available port and answers HTTP requests with an empty 200 response. The listen address can be customized with the --listen flag and will always be printed to stdout. If the listen address includes a port range, multiple servers will be started.
If a final, unnamed argument is given, it will be treated as a status code (same as the --status flag) if it is a 3-digit number. Otherwise, it is used as the response body (same as the --body flag). The --status and --body flags will always override this argument (for example, to write a body that literally says "404" but with a status code of 200, do ’--status 200 404’).
A body may be given in 3 ways: a flag, a final (and unnamed) argument to the command, or piped to stdin (if flag and argument are unset). Limited template evaluation is supported on the body, with the following variables:
{{.N}} The
server number (useful if using a port range)
{{.Port}} The listener port
{{.Address}} The listener address
(See the docs for the text/template package in the Go standard library for information about using templates: https://pkg.go.dev/text/template)
Access/request logging and more verbose debug logging can also be enabled.
Response headers may be added using the --header flag for each header field.
OPTIONS
|
--access-log[=false] |
Enable the access log | |
|
--body="" |
The body of the HTTP response | |
|
--debug[=false] |
Enable more verbose debug-level logging | |
|
--header=[] |
Set a header on the response (format: "Field: value" | |
|
-h, --help[=false] |
help for respond | |
|
--listen=":0" |
The address to which to bind the listener | |
|
--status=200 |
The response status code |
SEE ALSO
caddy(8)
HISTORY
17-Apr-2023 Auto generated by spf13/cobra