fileserver: Add pass_thru Caddyfile option (#4613)

This commit is contained in:
Francis Lavoie 2022-03-04 22:50:05 -05:00 committed by GitHub
parent be82cc7aca
commit 09ba9e994e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View file

@ -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
}
]
}
]
}
}
}
}
}

View file

@ -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())
}