diff options
author | Francis Lavoie <lavofr@gmail.com> | 2020-07-17 15:33:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-17 13:33:40 -0600 |
commit | 3fdaf507857bacddeeaeac2d23b1e15bb99bc633 (patch) | |
tree | 1b3c9486d7347db4d594be5ea8dac4953f5ce0af /modules/caddyhttp | |
parent | 19cc2bd3c3e6b551d47eca7a2efdee95eec2a86f (diff) |
fastcgi: Fill REMOTE_USER with http.auth.user.id placeholder (#3577)
Completing a TODO!
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r-- | modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go index 4a8c6d7..c12e932 100644 --- a/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go +++ b/modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go @@ -226,6 +226,11 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) { reqHost = r.Host } + authUser := "" + if val, ok := repl.Get("http.auth.user.id"); ok { + authUser = val.(string) + } + // Some variables are unused but cleared explicitly to prevent // the parent environment from interfering. env = map[string]string{ @@ -240,7 +245,7 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) { "REMOTE_HOST": ip, // For speed, remote host lookups disabled "REMOTE_PORT": port, "REMOTE_IDENT": "", // Not used - "REMOTE_USER": "", // TODO: once there are authentication handlers, populate this + "REMOTE_USER": authUser, "REQUEST_METHOD": r.Method, "REQUEST_SCHEME": requestScheme, "SERVER_NAME": reqHost, |