Re: Problems with authenticated background downloads involving a 301 redirect
Re: Problems with authenticated background downloads involving a 301 redirect
- Subject: Re: Problems with authenticated background downloads involving a 301 redirect
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Mon, 21 Jul 2014 10:18:18 +0100
On 19 Jul 2014, at 00:23, Scott Hancher <email@hidden> wrote:
> I'm downloading files from our servers using an https scheme and an OAuth 2 'Authorization' header. The server receiving the request redirects via a 301 to a different URL for the actual file to download.
>
> The download works without issue if it's performed in the foreground (NSURLSession created with an NSURLSessionConfiguration created via [NSURLSessionConfiguration ephemeralSessionConfiguration]).
>
> However, if a background download is attempted (using [NSURLSessionConfiguration backgroundSessionConfiguration:] to construct the NSURLSessionConfiguration), then the download fails via a 403 status code.
Do you have any cookies involved? The one case I've seen similar to this involves NSURLSession background sessions not picking up cookies on the redirect <rdar://problem/16852027>.
If there are no cookies involved then I recommend you take a packet trace of the two requests (the one from the ephemeral session and the one from the background session) and see what's different, that is, what's causing the server to fail the request.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden