0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00
caddy/modules/caddyhttp/fileserver
Francis Lavoie 3f6283b385
fileserver: Add status code override (#4076)
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).
2021-04-08 11:09:12 -06:00
..
testdata fileserver: Fix try_files for directories; windows fix (#3684) 2020-09-16 18:09:28 -06:00
browse.go fileserver: Fix "go up" links in browse listings (closes #3942) 2020-12-30 08:05:01 -07:00
browse_test.go fileserver: Fix inconsistencies in browse JSON 2020-08-31 12:33:43 -06:00
browselisting.go fileserver: Preserve transformed root (fix #3838) 2020-11-24 12:24:44 -07:00
browselisting_test.go ci: Use golangci's github action for linting (#3794) 2020-11-22 14:50:29 -07:00
browsetpl.go fileserver: Browse listing supports dark mode (#4066) 2021-03-19 11:41:02 -06:00
caddyfile.go fileserver: Add status code override (#4076) 2021-04-08 11:09:12 -06:00
command.go cmd: file-server: add --access-log flag (#3454) 2020-05-26 15:04:04 -06:00
matcher.go fastcgi: Set PATH_INFO to file matcher remainder as fallback (#3739) 2020-12-04 17:12:13 -07:00
matcher_test.go fastcgi: Set PATH_INFO to file matcher remainder as fallback (#3739) 2020-12-04 17:12:13 -07:00
staticfiles.go fileserver: Add status code override (#4076) 2021-04-08 11:09:12 -06:00
staticfiles_test.go fileserver: Improve and clarify file hiding logic (#3844) 2020-11-02 14:20:12 -07:00