Caddy(8)
π caddy-respond β the man page but make it slay π
okay bestie, welcome to the Caddy manual, section 8 β¨ this one's the respond page, and it's genuinely one of my faves because it's soooo low effort in the best way. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
caddy-respond β simple, hard-coded HTTP responses for development and testing π
like. it does ONE thing. and it ate. no cap. π
β¨ SYNOPSIS β¨
caddy respond [--status ] [--body ] [--listen ] [--access-log] [--debug]
[--header "Field: value"] [flags]
(you can also just... pass stuff. we'll get to that, don't worry π)
β¨ DESCRIPTION β¨
So the whole vibe is: it spins up a quick-and-clean HTTP server for development and testing purposes. that's it. that's the post. π¦
With no options specified, this command listens on a random available port and answers HTTP requests with an empty 200 response. iconic. minimalist. she said "no thoughts, head empty, 200 OK".
The listen address can be customized with the --listen flag, and it will always be printed to stdout β so don't be sitting there like "what port tho" because it literally tells you, bestie. π If the listen address includes a port range, then multiple servers will be started. yes, plural. she's multitasking. π
okay now, the final, unnamed argument situation, because this is the part everyone gets confused about:
If a final, unnamed argument is given, it gets 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).
And here's the plot twist π: the --status and --body flags will always override this argument. so if you wanna write a body that literally says 404 but with a status code of 200, you do:
--status 200 404
slay. the numbers are lies and that's the point. π
π how to give her a body π
A body may be given in 3 ways:
- a flag (
--body) - a final (and unnamed) argument to the command
- piped to stdin β but only 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
(no fr, go read the docs for the text/template package in the Go standard library for info about using templates: https://pkg.go.dev/text/template β iykyk π§)
Also, access/request logging and more verbose debug logging can also be enabled, because sometimes you need to see everything she's thinking. π
And response headers may be added using the --header flag β one flag for each header field. π
β¨ OPTIONS β¨
--access-log[=false]β Enable the access log π-b,--body=""β The body of the HTTP response π«Ά-v,--debug[=false]β Enable more verbose debug-level logging π-H,--header=[]β Set a header on the response (format:"Field: value") π-h,--help[=false]β help for respond β-l,--listen=":0"β The address to which to bind the listener πΈ-s,--status=200β The response status code β¨
β¨ SEE ALSO β¨
caddy(8)π
β¨ HISTORY β¨
1-Jan-0001β Auto generated byspf13/cobraπ
okay that's the whole page, you're basically a Caddy girlie now, no cap π if you forget anything just run caddy respond --help and she'll remind you. periodt. π
tiny lil sign-off: this page was Auto generated byspf13/cobra, datedJan 0001, and it's part of theCaddy(8)manual. bye bestie, go spin up a server π¦π
π¦ where this page comes from
- ubuntu stonking: caddy 2.11.4-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms