@marcel91200 / caddy Mirror · read-only / commits / 2eede58b
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

fastcgi: Ensure root is always absolute (issue #3178) (#3182)

Matt Holt committed Mar 23, 2020 at 21:12 UTC 2eede58b3a0f39d0cb0552eadaec02a0169835ac
1 file changed +6 -1
modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
+6 -1
@@ -164,7 +164,12 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
164 ip = strings.Replace(ip, "[", "", 1)
165 ip = strings.Replace(ip, "]", "", 1)
166
167 - root := repl.ReplaceAll(t.Root, ".")
167 + // make sure file root is absolute
168 + root, err := filepath.Abs(repl.ReplaceAll(t.Root, "."))
169 + if err != nil {
170 + return nil, err
171 + }
172 +
173 fpath := r.URL.Path
174
175 // Split path in preparation for env variables.