{"action":"created","issue":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/798","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/798/labels{/name}","comments_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/798/comments","events_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/798/events","html_url":"https://github.com/Alamofire/Alamofire/issues/798","id":107547607,"number":798,"title":"Added headers not sent when following redirects","user":{"login":"eburi","id":699615,"avatar_url":"https://avatars.githubusercontent.com/u/699615?v=3","gravatar_id":"","url":"https://api.github.com/users/eburi","html_url":"https://github.com/eburi","followers_url":"https://api.github.com/users/eburi/followers","following_url":"https://api.github.com/users/eburi/following{/other_user}","gists_url":"https://api.github.com/users/eburi/gists{/gist_id}","starred_url":"https://api.github.com/users/eburi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eburi/subscriptions","organizations_url":"https://api.github.com/users/eburi/orgs","repos_url":"https://api.github.com/users/eburi/repos","events_url":"https://api.github.com/users/eburi/events{/privacy}","received_events_url":"https://api.github.com/users/eburi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Alamofire/Alamofire/labels/question","name":"question","color":"FF7E00"},{"url":"https://api.github.com/repos/Alamofire/Alamofire/labels/session%20delegate","name":"session delegate","color":"69B805"},{"url":"https://api.github.com/repos/Alamofire/Alamofire/labels/url%20session","name":"url session","color":"69B805"}],"state":"closed","locked":false,"assignee":{"login":"cnoon","id":169110,"avatar_url":"https://avatars.githubusercontent.com/u/169110?v=3","gravatar_id":"","url":"https://api.github.com/users/cnoon","html_url":"https://github.com/cnoon","followers_url":"https://api.github.com/users/cnoon/followers","following_url":"https://api.github.com/users/cnoon/following{/other_user}","gists_url":"https://api.github.com/users/cnoon/gists{/gist_id}","starred_url":"https://api.github.com/users/cnoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnoon/subscriptions","organizations_url":"https://api.github.com/users/cnoon/orgs","repos_url":"https://api.github.com/users/cnoon/repos","events_url":"https://api.github.com/users/cnoon/events{/privacy}","received_events_url":"https://api.github.com/users/cnoon/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Alamofire/Alamofire/milestones/14","html_url":"https://github.com/Alamofire/Alamofire/milestones/3.0.0","labels_url":"https://api.github.com/repos/Alamofire/Alamofire/milestones/14/labels","id":1317718,"number":14,"title":"3.0.0","description":"Official 3.0 release","creator":{"login":"cnoon","id":169110,"avatar_url":"https://avatars.githubusercontent.com/u/169110?v=3","gravatar_id":"","url":"https://api.github.com/users/cnoon","html_url":"https://github.com/cnoon","followers_url":"https://api.github.com/users/cnoon/followers","following_url":"https://api.github.com/users/cnoon/following{/other_user}","gists_url":"https://api.github.com/users/cnoon/gists{/gist_id}","starred_url":"https://api.github.com/users/cnoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnoon/subscriptions","organizations_url":"https://api.github.com/users/cnoon/orgs","repos_url":"https://api.github.com/users/cnoon/repos","events_url":"https://api.github.com/users/cnoon/events{/privacy}","received_events_url":"https://api.github.com/users/cnoon/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":1,"state":"open","created_at":"2015-09-22T03:28:53Z","updated_at":"2015-09-22T04:35:22Z","due_on":"2015-09-28T07:00:00Z","closed_at":null},"comments":3,"created_at":"2015-09-21T16:17:15Z","updated_at":"2015-09-22T09:11:23Z","closed_at":"2015-09-22T04:34:52Z","body":"Xcode 7, iOS 9, Alamofire 2.0.1\r\n\r\nWhen following a redirect, the headers added to the original request, will not be added to the new request.\r\n\r\nExample (#788):\r\n```\r\nlet headers = [\r\n            \"Authorization\": userData.userAPIKey!,\r\n        ]\r\nAlamofire.request(.GET, url, parameters: nil, encoding: .URL, headers: headers).response { (request, response, data, error) -> Void in\r\n}\r\n```\r\n\r\nIf the server responds with a 301 Moved permanently, a new request is made to the location returned. But the new request will not have the Authorization-Header set.\r\n\r\nI saw #314, #317, and #424 But I think this is a different issue. IMHO Alamofire should either follow redirects and add the headers added to the original-request or it should not follow redirects at all and report them to the user. In #788 I found out the hard way looking at what was sent over the wire.\r\n\r\nAs a user of Alamofire, I don't get any notification/log-message, when the library is following a redirect. This is very handy, but I would expect, that the my extra-headers would also be applied to the new-request."},"comment":{"url":"https://api.github.com/repos/Alamofire/Alamofire/issues/comments/142221501","html_url":"https://github.com/Alamofire/Alamofire/issues/798#issuecomment-142221501","issue_url":"https://api.github.com/repos/Alamofire/Alamofire/issues/798","id":142221501,"user":{"login":"eburi","id":699615,"avatar_url":"https://avatars.githubusercontent.com/u/699615?v=3","gravatar_id":"","url":"https://api.github.com/users/eburi","html_url":"https://github.com/eburi","followers_url":"https://api.github.com/users/eburi/followers","following_url":"https://api.github.com/users/eburi/following{/other_user}","gists_url":"https://api.github.com/users/eburi/gists{/gist_id}","starred_url":"https://api.github.com/users/eburi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eburi/subscriptions","organizations_url":"https://api.github.com/users/eburi/orgs","repos_url":"https://api.github.com/users/eburi/repos","events_url":"https://api.github.com/users/eburi/events{/privacy}","received_events_url":"https://api.github.com/users/eburi/received_events","type":"User","site_admin":false},"created_at":"2015-09-22T09:11:23Z","updated_at":"2015-09-22T09:11:23Z","body":"Thanks, for the quick reply!\r\nI won't take this to Apple - this is most likely by design for security reasons. \r\n\r\nAnd now we know how to work around it!"}}