Browse Source

fileserver: Add `pass_thru` Caddyfile option (#4613)

master
Francis Lavoie 3 years ago
committed by GitHub
parent
commit
09ba9e994e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt
  2. 6
      modules/caddyhttp/fileserver/caddyfile.go

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

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

Loading…
Cancel
Save