mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05:00 
			
		
		
		
	Merge pull request #172 from abiosoft/fastcgi-fix
fastcgi: Fix for Issue 141: index not found, 502 Bad Gateway.
This commit is contained in:
		
						commit
						75b77d508d
					
				@ -176,7 +176,6 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
 | 
			
		||||
		"CONTENT_TYPE":      r.Header.Get("Content-Type"),
 | 
			
		||||
		"GATEWAY_INTERFACE": "CGI/1.1",
 | 
			
		||||
		"PATH_INFO":         pathInfo,
 | 
			
		||||
		"PATH_TRANSLATED":   filepath.Join(h.AbsRoot, pathInfo), // Info: http://www.oreilly.com/openbook/cgi/ch02_04.html
 | 
			
		||||
		"QUERY_STRING":      r.URL.RawQuery,
 | 
			
		||||
		"REMOTE_ADDR":       ip,
 | 
			
		||||
		"REMOTE_HOST":       ip, // For speed, remote host lookups disabled
 | 
			
		||||
@ -198,6 +197,13 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string]
 | 
			
		||||
		"SCRIPT_NAME":     scriptName,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// compliance with the CGI specification that PATH_TRANSLATED
 | 
			
		||||
	// should only exist if PATH_INFO is defined.
 | 
			
		||||
	// Info: https://www.ietf.org/rfc/rfc3875 Page 14
 | 
			
		||||
	if env["PATH_INFO"] != "" {
 | 
			
		||||
		env["PATH_TRANSLATED"] = filepath.Join(h.AbsRoot, pathInfo) // Info: http://www.oreilly.com/openbook/cgi/ch02_04.html
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Add env variables from config
 | 
			
		||||
	for _, envVar := range rule.EnvVars {
 | 
			
		||||
		env[envVar[0]] = envVar[1]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user