diff --git a/caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt b/caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt new file mode 100644 index 00000000..476b165d --- /dev/null +++ b/caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt @@ -0,0 +1,32 @@ +:80 + +file_server { + pass_thru +} +---------- +{ + "apps": { + "http": { + "servers": { + "srv0": { + "listen": [ + ":80" + ], + "routes": [ + { + "handle": [ + { + "handler": "file_server", + "hide": [ + "./Caddyfile" + ], + "pass_thru": true + } + ] + } + ] + } + } + } + } +} diff --git a/modules/caddyhttp/fileserver/caddyfile.go b/modules/caddyhttp/fileserver/caddyfile.go index 886d6672..26415353 100644 --- a/modules/caddyhttp/fileserver/caddyfile.go +++ b/modules/caddyhttp/fileserver/caddyfile.go @@ -120,6 +120,12 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) falseBool := false fsrv.CanonicalURIs = &falseBool + case "pass_thru": + if h.NextArg() { + return nil, h.ArgErr() + } + fsrv.PassThru = true + default: return nil, h.Errf("unknown subdirective '%s'", h.Val()) }