I want to get Location header value(302 HTTP redirect) within an API call success callback. I have tried headers('Location') but console.log() shows null. how can I fetch response headers properly?
Response Headers :
Cache-Control:no-cache
Connection:Keep-Alive
Content-Length:324
Content-Type:text/html; charset=UTF-8
Date:Thu, 15 Oct 2015 18:51:04 GMT
Keep-Alive:timeout=5, max=100
Location:http://localhost/redirect --------------- Redirect Uri
Server:Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.12
Angular success callback :
.success(function (data, status, headers, config) {
window.location.href = headers('Location');
})
Locationheader from first (= different) response headers, as you can read there.