So im using Apache 2.4, I want to set up a basic auth connected with LDAP and then, reverse proxy. The idea is to secure a webpage with this authorization. So here is my config:

   Order deny,allow
   Deny from All
   AuthType Basic
   AuthName "Please login"
   AuthBasicProvider ldap
   #LDAPVerifyServerCert Off
   AuthLDAPURL ldap://ldap data here
   AuthLDAPBindDN "dn here"
   AuthLDAPBindPassword pass
   AuthLDAPGroupAttribute sAMAccountName
   AuthLDAPGroupAttributeIsDN off
   #Require ldap-group some settings
   Require ldap-filter ldapsettingshere
   AuthLDAPMaxSubGroupDepth 1
   #Require valid-user
   #Satisfy any
   RequestHeader unset Authorization

   ProxyRequests On
ProxyVia On

ProxyPass / http://numbers:8090/
ProxyPassReverse / http://numbers:8090/
ProxyPreserveHost On
#RequestHeader set Authorization "Basic"
#ProxyRequests           Off
#AllowEncodedSlashes     NoDecode
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"

The problem is that when I access my Apache http it doesn't prompt for the basic auth password and login, it just goes straight to the proxied webpage. Any idea what am I doin wrong?

UPDATE: OK, I have uncommented:

RequestHeader set Authorization "Basic"

But now Im in infinite loop of basic auth prompts, which are coming from the end server so its not the case.

  • Check the server log files. If the authentication fails apache will keep prompting for credentials. – Gerald Schneider Jan 18 '18 at 10:25
  • I'm sure LDAP itself is fine, I have tested it, there are no LDAP errors. – Chrzciciel Jan 18 '18 at 10:36
  • OK, this auth prompt was actually coming from the server which I was trying reach. So we can say Im still not getting the prompt from my Apache. – Chrzciciel Jan 18 '18 at 10:59

The cause of this was that I have put the whole Auth part inside <Directory "/var/www/html"></Directory>, I have changed it to <Location "/"></Location> and it works like a charm!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.