Skip to content

Commit

Permalink
fileserver: Add pass_thru Caddyfile option (#4613)
Browse files Browse the repository at this point in the history
  • Loading branch information
francislavoie authored Mar 5, 2022
1 parent be82cc7 commit 09ba9e9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
32 changes: 32 additions & 0 deletions caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 0 deletions modules/caddyhttp/fileserver/caddyfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 09ba9e9

Please sign in to comment.