From 8d81ae88dacaf94d0fc70268cb03050a9e3e6bef Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 3 Aug 2015 17:16:24 -0600 Subject: [PATCH] fastcgi: Add HTTPS env variable on HTTPS connections --- middleware/fastcgi/fastcgi.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/middleware/fastcgi/fastcgi.go b/middleware/fastcgi/fastcgi.go index 2a57a84b..85e5b522 100644 --- a/middleware/fastcgi/fastcgi.go +++ b/middleware/fastcgi/fastcgi.go @@ -204,6 +204,11 @@ func (h Handler) buildEnv(r *http.Request, rule Rule, fpath string) (map[string] env["PATH_TRANSLATED"] = filepath.Join(h.AbsRoot, pathInfo) // Info: http://www.oreilly.com/openbook/cgi/ch02_04.html } + // Some web apps rely on knowing HTTPS or not + if r.TLS != nil { + env["HTTPS"] = "on" + } + // Add env variables from config for _, envVar := range rule.EnvVars { env[envVar[0]] = envVar[1]