1Caddy(8)                                                              Caddy(8)
2
3
4

NAME

6       caddy-respond  -  Simple, hard-coded HTTP responses for development and
7       testing
8
9
10

SYNOPSIS

12       caddy respond [flags]
13
14
15

DESCRIPTION

17       Spins up a quick-and-clean HTTP server for development and testing pur‐
18       poses.
19
20
21       With  no  options specified, this command listens on a random available
22       port and answers HTTP requests with an empty 200 response.  The  listen
23       address  can  be  customized  with the --listen flag and will always be
24       printed to stdout.  If the listen address includes a port range, multi‐
25       ple servers will be started.
26
27
28       If  a  final, unnamed argument is given, it will be treated as a status
29       code (same as the --status flag) if it is a 3-digit number.  Otherwise,
30       it is used as the response body (same as the --body flag). The --status
31       and --body flags will always override this argument  (for  example,  to
32       write  a  body that literally says "404" but with a status code of 200,
33       do '--status 200 404').
34
35
36       A body may be given in 3 ways: a flag, a final (and  unnamed)  argument
37       to  the  command,  or  piped to stdin (if flag and argument are unset).
38       Limited template evaluation is supported on the body, with the  follow‐
39       ing variables:
40
41
42              {{.N}}        The server number (useful if using a port range)
43              {{.Port}}     The listener port
44              {{.Address}}  The listener address
45
46
47
48       (See  the docs for the text/template package in the Go standard library
49       for information  about  using  templates:  https://pkg.go.dev/text/tem
50       plate)
51
52
53       Access/request  logging  and more verbose debug logging can also be en‐
54       abled.
55
56
57       Response headers may be added using the --header flag for  each  header
58       field.
59
60
61

OPTIONS

63       --access-log[=false]      Enable the access log
64
65
66       -b, --body=""      The body of the HTTP response
67
68
69       -v, --debug[=false]      Enable more verbose debug-level logging
70
71
72       -H,  --header=[]       Set  a  header  on the response (format: "Field:
73       value")
74
75
76       -h, --help[=false]      help for respond
77
78
79       -l, --listen=":0"      The address to which to bind the listener
80
81
82       -s, --status=200      The response status code
83
84
85

SEE ALSO

87       caddy(8)
88
89
90

HISTORY

92       30-Oct-2023 Auto generated by spf13/cobra
93
94
95
96Auto generated by spf13/cobra      Oct 2023                           Caddy(8)
Impressum