diff --git a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go index 99bf5ec8..11900c1a 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go @@ -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.