My application is in PHP
and AngularJS
(migrating from PHP to AngularJS).
Let us say the Apache HTTPD
server is on domain1
and the backend (Apache Tomcat
) is on domain2
.
When I request for apps which are in AngularJS
, the JavaScript
files are loaded from domain1
. After the browser has loaded of all JavaScript
files, AngularJS
kicks in and the client requests for data from domain2
.
The domain2
server wants to authenticate the caller and so responds the browser with a status code 401
and header WWW-Authenticate: Basic
.
With Chrome, Firefox and IE, the browser prompts for a username and password (the prompt is the browser in-built one not my custom made). In Safari it does not, instead in the Safari console I get the following message -
http://domain2/request
Failed to load resource: the server responded with a status 401 (Unauthorized)
The backend server has CORS enabled.