Web / Caddy Server Interview questions
Explain the execution flow of an HTTP request in Caddy?
A request passes through several distinct stages between hitting the network socket and reaching the client back as a response.
The listener accepts the raw connection first; if it's HTTPS, the TLS layer terminates encryption using the appropriate certificate for the requested hostname (via SNI). The decrypted request then goes to Caddy's router, which evaluates matchers in order to pick the right route. Inside that route, directives execute as a middleware chain - each handler can modify the request, short-circuit with a response, or call the next handler - until either a terminal handler like respond or file_server answers directly, or reverse_proxy forwards to an upstream and relays its response back to the client.
More Related questions...