diff --git a/middleware/fastcgi/fastcgi.go b/middleware/fastcgi/fastcgi.go old mode 100644 new mode 100755 index 85e5b522..9da9c02f --- a/middleware/fastcgi/fastcgi.go +++ b/middleware/fastcgi/fastcgi.go @@ -166,6 +166,12 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string] scriptFilename = absPath } + // Strip PATH_INFO from SCRIPT_NAME + indexPathInfo := strings.LastIndex(scriptName, pathInfo) + if indexPathInfo != -1 { + scriptName = scriptName[:indexPathInfo] + } + // Some variables are unused but cleared explicitly to prevent // the parent environment from interfering. env = map[string]string{