From aa5a59576256021f4e9e2b3c2373d10b05910c0b Mon Sep 17 00:00:00 2001 From: Mathias Beke Date: Wed, 16 Sep 2015 20:25:40 +0200 Subject: [PATCH] middleware/fastcgi: Stripping PATH_INFO from SCRIPT_NAME --- middleware/fastcgi/fastcgi.go | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100644 => 100755 middleware/fastcgi/fastcgi.go 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{