Web / Caddy Server Interview questions
What is the respond directive used for?
respond writes a static response body and status code directly, without touching the file system or an upstream. It's the quickest way to return a fixed answer for a route.
:8080 { respond "Service is healthy" 200 } api.example.com { respond /health "OK" 200 reverse_proxy localhost:4000 }
Typical uses are health-check endpoints, maintenance pages, quick placeholder responses while a backend is being built, and returning custom error bodies. Because respond is a terminal handler, it stops the rest of the directive chain for that request once it runs.
More Related questions...