0

No matter where I put %{REMOTE_USER}, I got NULL. Can you please tell me how I can configure NTLM Apache in order to get REMOTE_USER ?

    RewriteEngine On
    #RewriteCond %{LA-U:REMOTE_USER} (.+)
    #RewriteRule . - [E=RU:%1]
    #RequestHeader set X-Remote-User "%{RU}e" env=RU
    #RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]

    RewriteRule . - [E=RU:%{LA-U:REMOTE_USER}]
    RequestHeader set REMOTE_USER %{RU}e


    ProxyPass   "xxxx"
    ProxyPassReverse  "xxxxx"

    AuthType NTLM
    AuthName xxxxxxxxx
    PythonAuthenHandler pyntlm
    PythonOption Domain xxxxxxxxx
    PythonOption BDC xxxxxxxxxxx
    PythonOption PDC xxxxxxxxxxxxx


    RequestHeader set REMOTE_USER %{REMOTE_USER}s
    SetEnv proxy-chain-auth On
    ProxyPassInterpolateEnv On
    Header set Access-Control-Allow-Credentials "true"
    Header set Access-Control-Allow-Headers "origin, authorization, accept, X-      Requested-With, Content-Type, Content-Length"

EDIT: I even tried to hard code the RequestHeader but still does not work;

  RequestHeader set  X-Forwarded-User 'toto'
  RequestHeader set REMOTE_USER 'toto'
  RequestHeader set X-REMOTE-USER 'toto'
  RequestHeader set  X-Forwarded-For 'toto'
mehmetozer
  • 109
  • 3
  • Is the URI you are requesting under the context in `ProxyPass` directive? mod_proxy has a very high priority and usually gets any request prior to other modules – NuTTyX Mar 23 '15 at 19:51
  • Yeah its under the context ProxyPass. In addition to that, I have used to set RequestHeader with a hard coded variable, still does not working. Any idea ? – mehmetozer Mar 24 '15 at 10:16
  • As I told you, mod_proxy is dealing with the request prior to RewriteRule or RequestHeader, those modules will not work on requests _except_ if you use `RequestHeader` with `early` flag, but that forces mod_headers to execute before apache has checked anything in the incoming request, so you cannot extract any variable like REMOTE_USER. If you pretend to configure NTLM authentication on that context, surround the auth config by `` and ``. Check this other post for a similar case: http://stackoverflow.com/questions/724599/setting-up-an-apache-proxy-with-authentication – NuTTyX Mar 24 '15 at 21:03
  • I ve tried it but NTML Auth is disabled once I tried it, now I have a NTML onfig inside ntlm config but it works like we have no need authentification. the tag is under and the tag does not allow the tag – mehmetozer Mar 25 '15 at 13:49

0 Answers0