mod_auth_openid
mod_auth_openid copied to clipboard
REMOTE_USER not available to proxied applications
I'm using mod_proxy and mod_auth_openid together, with a rewrite rule that should populate the X-Forwarded-User
header from the contents of REMOTE_USER
:
<Proxy *>
AuthType OpenID
require valid-user
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule . - [E=RU:%1]
RequestHeader add X-Forwarded-User %{RU}e
</Proxy>
The trouble is that the header set in the proxied requests always looks like this:
X-Forwarded-User: (null)
I can see that the OpenID session cookie is present in the request, though.
According to the mod-proxy-add-user github project, mod_auth_openid may not be setting REMOTE_USER
at the right time, which is why it's not available.
I'll try to take a look at this over the weekend.
I found a workaround to this by adding the following line after r->user is set...
r->user = apr_pstrdup(r->pool, idchar);
+ apr_table_set(r->headers_in, "X-Forwarded-User", r->user);