Can someone tell me why the WWW-Authenticate header is null in the response, although I can see the WWW-Authenticate header string object in Chrome dev tools?
On the server side, I am doing the following to set the WWW-Authenticate header, and also set the correct headers for CORS:
res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8080'); res.setHeader('Access-Control-Expose-Headers', 'WWW-Authenticate'); res.setHeader('WWW-Authenticate', JSON.stringify({ "token": "encryptedToken", "message": "encryptedMessage" }));
I believe that I have correctly configured the header on the server side, because when I look at the Chrome Dev tools, I see the following in the “Response headers” section for the requested request.
Answer Header
Access-Control-Allow-Origin : http: // localhost: 8080
Access-Control-Expose-Headers : WWW-Authenticate
Connection : keep-alive
Date : Friday, May 15, 2015 13:48:29 GMT
ETag : W / "f7-1470611871"
WWW authentication : {"token": "encryptedToken", "message": "encryptedMessage"}
X-Powered-By : Express
HOWEVER, when I try to access the "WWW-Authenticate" header from a response, I get NULL.
$http.get("http://localhost:4242/days") .then(function (response) { var AuthHeader = response.headers('WWW-Authenticate'); console.log (AuthHeader);
Thanks for your help in advance!
source share