Browse Source

fastcgi: Fill REMOTE_USER with http.auth.user.id placeholder (#3577)

Completing a TODO!
master
Francis Lavoie 5 years ago
committed by GitHub
parent
commit
3fdaf50785
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go

7
modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go

@ -226,6 +226,11 @@ func (t Transport) buildEnv(r *http.Request) (map[string]string, error) {
reqHost = r.Host 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 // Some variables are unused but cleared explicitly to prevent
// the parent environment from interfering. // the parent environment from interfering.
env = map[string]string{ 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_HOST": ip, // For speed, remote host lookups disabled
"REMOTE_PORT": port, "REMOTE_PORT": port,
"REMOTE_IDENT": "", // Not used "REMOTE_IDENT": "", // Not used
"REMOTE_USER": "", // TODO: once there are authentication handlers, populate this "REMOTE_USER": authUser,
"REQUEST_METHOD": r.Method, "REQUEST_METHOD": r.Method,
"REQUEST_SCHEME": requestScheme, "REQUEST_SCHEME": requestScheme,
"SERVER_NAME": reqHost, "SERVER_NAME": reqHost,

Loading…
Cancel
Save