1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

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

This commit is contained in:
Matt Holt 2020-03-23 21:12:54 -06:00 committed by GitHub
parent 235357abc8
commit 2eede58b3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,7 +164,12 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
ip = strings.Replace(ip, "[", "", 1)
ip = strings.Replace(ip, "]", "", 1)
root := repl.ReplaceAll(t.Root, ".")
// make sure file root is absolute
root, err := filepath.Abs(repl.ReplaceAll(t.Root, "."))
if err != nil {
return nil, err
}
fpath := r.URL.Path
// Split path in preparation for env variables.