IIS as proxy to rails/mongrel - force a proxied host to generate REMOTE_USER

Posted by rbn on Stack Overflow See other posts from Stack Overflow or by rbn
Published on 2010-04-28T19:34:24Z Indexed on 2010/04/28 19:37 UTC
Read the original article Hit count: 480

Filed under:
|
|
|

Hello -- Using Application Request Routing I have IIS 7.5 set up as a reverse proxy to a Mongrel service which is serving a rails app. IIS is set up to use Windows Auth and is working but I cannot access the REMOTE_USER variable in the rails app to get at current user's identity. I have inspected the request object in rails and I don't have any other variables like LOGON_USER, HTTP_REMOTE_USER, AUTH_USER, etc. I am trying to find a way to inject the REMOTE_USER variable into Mongrel's server variables. This post describes what I am looking for using mod_rewrite on Apache but I am having trouble recreating this rule for iis.

this is the rewrite rule from the post mentioned above for Apache

RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule . - [E=RU:%1]
Header add X-Forwarded-User %{RU}e

I tried reproducing the rule in IIS and got a URL Rewrite Module error ("The condition's expression "%{LA-U:REMOTE_USER}" is invalid."). I know I'm probably using Apache syntax where IIS syntax is needed but am not sure how to proceed at this point. Any help greatly appreciated.

© Stack Overflow or respective owner

Related posts about iis

Related posts about ruby-on-rails