apachentlmntlmv2

How to redirect on custom url after NTLM authentication failure


I am using NTLM authentication with ldap.

enter image description here

When i click 'cancel' in the above popup, it gives 'Authorization required' message as belowenter image description here

I want it to redirect on a custom url on 'Cancel' click. How can i achieve it?


Solution

  • Cancel has the same effect as no authentication, so you're going to get a 401 error code for both Cancel and bad authorizations. In that case, you can set up custom URLs for error codes as described here. The custom error is virtual-host scoped if I recall correctly, so this will be shown for all authentication errors for that particular domain.

    If you want to get more control of it, you have to prevent the authentication challenge from happening via http at the server level. This means bringing it down to the web application level where you need to make your pages check that authentication has properly occurred. If you're serving static web pages, this obviously won't work.