As others have pointed out, the only way to change browser behavior is to make sure that the response either does not contain a 401 status code, or, if there is one, does not include the WWW-Authenticate: Basic header. Since changing the status code is not very semantic and undesirable, removing the WWW-Authenticate header is a good approach. If you cannot or do not want to modify the web server application, you can always serve or proxy the server through Apache (if you are not already using Apache).
Here is the configuration for Apache to overwrite the response to removing the IFF-Authenticate IFF header containing the request contains the X-Requested-With: XMLHttpRequest header X-Requested-With: XMLHttpRequest (which is set by default with the main Javascript frameworks like JQuery / AngularJS, etc.). ) And the response contains the WWW-Authenticate: Basic header.
Tested on Apache 2.4 (not sure if it works with 2.2). It depends on the installed mod_headers module. (On Debian / Ubuntu, sudo a2enmod headers and restart Apache)
<Location />
syastrov Jun 20 '16 at 9:31 2016-06-20 09:31
source share