From 235357abc80df710fe4c4ec21cf76d84cc664e17 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 23 Mar 2020 18:29:16 -0600 Subject: fastcgi: Fix PATH_INFO (issue #3178) --- modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/caddyhttp/reverseproxy/fastcgi') diff --git a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go index 9d2dc39..99bf5ec 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go @@ -173,8 +173,8 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) { splitPos := t.splitPos(fpath) // Request has the extension; path was split successfully - docURI := fpath[:splitPos+len(t.SplitPath)] - pathInfo := fpath[splitPos+len(t.SplitPath):] + docURI := fpath[:splitPos] + pathInfo := fpath[splitPos:] scriptName := fpath // Strip PATH_INFO from SCRIPT_NAME @@ -292,7 +292,7 @@ func (t Transport) splitPos(path string) int { lowerPath := strings.ToLower(path) for _, split := range t.SplitPath { if idx := strings.Index(lowerPath, strings.ToLower(split)); idx > -1 { - return idx + return idx + len(split) } } return -1 -- cgit v1.2.3