0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-30 22:34:15 -05:00
caddy/caddyhttp/staticfiles
Jannis Andrija Schnitzer 11eee95222 staticfiles: Signal that redirection headers have been written (#2792)
The Handler interface expects a first return value of 0 if headers have
already been written.
(cf. https://godoc.org/github.com/caddyserver/caddy/caddyhttp/httpserver#Handler)

When using http.Redirect, this is the case as http.Redirect does write
headers. When using Caddy with nested handlers, returning
http.StatusMovedPermanently could cause a wrong (200) response on a
non-slashy request on a directory name. Returning 0 ensures the
redirection will always take place.
2019-10-07 10:22:53 -06:00
..
fileserver.go staticfiles: Signal that redirection headers have been written (#2792) 2019-10-07 10:22:53 -06:00
fileserver_test.go staticfiles: Signal that redirection headers have been written (#2792) 2019-10-07 10:22:53 -06:00