mirror of
https://github.com/caddyserver/caddy.git
synced 2026-06-26 20:01:34 +00:00
After reading a question about the `handle_response` feature of `reverse_proxy`, I realized that we didn't have a way of serving an arbitrary file with a status code other than 200. This is an issue in situations where you want to serve a custom error page in routes that are not errors, like the aforementioned `handle_response`, where you may want to retain the status code returned by the proxy but write a response with content from a file. This feature is super simple, basically if a status code is configured (can be a status code number, or a placeholder string) then that status will be written out before serving the file - if we write the status code first, then the stdlib won't write its own (only the first HTTP status header wins). |
||
|---|---|---|
| .. | ||
| testdata | ||
| browse.go | ||
| browse_test.go | ||
| browselisting.go | ||
| browselisting_test.go | ||
| browsetpl.go | ||
| caddyfile.go | ||
| command.go | ||
| matcher.go | ||
| matcher_test.go | ||
| staticfiles.go | ||
| staticfiles_test.go | ||