Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
fastcgi: Fill REMOTE_USER with http.auth.user.id placeholder (#3577)
Completing a TODO!
Francis Lavoie committed
Jul 17, 2020 at 15:33 UTC
3fdaf507857bacddeeaeac2d23b1e15bb99bc633
1 file changed
+6
-1
modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go
+6
-1
@@ -226,6 +226,11 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
226
reqHost = r.Host
227
}
228
229
+ authUser := ""
230
+ if val, ok := repl.Get("http.auth.user.id"); ok {
231
+ authUser = val.(string)
232
+ }
233
+
234
// Some variables are unused but cleared explicitly to prevent
235
// the parent environment from interfering.
236
env = map[string]string{
@@ -240,7 +245,7 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
245
"REMOTE_HOST": ip, // For speed, remote host lookups disabled
246
"REMOTE_PORT": port,
247
"REMOTE_IDENT": "", // Not used
243
- "REMOTE_USER": "", // TODO: once there are authentication handlers, populate this
248
+ "REMOTE_USER": authUser,
249
"REQUEST_METHOD": r.Method,
250
"REQUEST_SCHEME": requestScheme,
251
"SERVER_NAME": reqHost,