Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 13, 21:45 UTC
fileserver: Add `pass_thru` Caddyfile option (#4613)
Francis Lavoie committed
Mar 4, 2022 at 22:50 UTC
09ba9e994e6391162fbfdfbd90c72270bdff3a49
2 files changed
+38
caddytest/integration/caddyfile_adapt/file_server_pass_thru.txt
new
+32
@@ -0,0 +1,32 @@
1
+:80
2
+
3
+file_server {
4
+ pass_thru
5
+}
6
+----------
7
+{
8
+ "apps": {
9
+ "http": {
10
+ "servers": {
11
+ "srv0": {
12
+ "listen": [
13
+ ":80"
14
+ ],
15
+ "routes": [
16
+ {
17
+ "handle": [
18
+ {
19
+ "handler": "file_server",
20
+ "hide": [
21
+ "./Caddyfile"
22
+ ],
23
+ "pass_thru": true
24
+ }
25
+ ]
26
+ }
27
+ ]
28
+ }
29
+ }
30
+ }
31
+ }
32
+}
modules/caddyhttp/fileserver/caddyfile.go
+6
@@ -120,6 +120,12 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
120
falseBool := false
121
fsrv.CanonicalURIs = &falseBool
122
123
+ case "pass_thru":
124
+ if h.NextArg() {
125
+ return nil, h.ArgErr()
126
+ }
127
+ fsrv.PassThru = true
128
+
129
default:
130
return nil, h.Errf("unknown subdirective '%s'", h.Val())
131
}