nativescript-background-http
nativescript-background-http copied to clipboard
iOS: Does not follow recursive redirect
When final response is a Redirection, it should follow the redirect, and then make the completion.
Right now, it just hangs and complete/responded events are never notified.
Edit: it actualy occurs when redirection response is also a redirection. It should recursively follow redirection until a certain configurable limit (followRedirect: number = 10)
I tried to reproduce this issue in iOS and the demo app from this repository but everything worked as expected.
I modified the server at /examples/www/server.js and added the following code:
response.writeHead(301, {
Location: "http://some_test_url/"
});
response.end();
to redirect to a simple page with the text "DONE WITH REDIRECT!". After the file upload, the redirect worked:

If you still experience this issue, please check your server code to see how the redirect is performed.
Note: I'm using multipart
I will double checked. Right now in emergency I had to write a Proxy sending directly the response.
Actualy, the complete scenario is to post a video to a video provider (vimeo), except the only moment they send us the final video_id is at the end of the upload (weird implementation):
- At the end of the upload : 301 to their server somewhere
- This redirect emit a second redirect : 301 to the redirect uri provided with a video_id parameter appended.
Maybe it follows the first redirect, but fails to follow the second one ? Anyway, the upload just hangs, we only have currentBytes === totalBytes on last progress, but neither complete, responded nor error is emitted.
The only thing I need is to retrieve this video_id for which I need to know the Location header of the second redirect, or at least the URL of the last redirect. But even when it works, we don't have a full access to the response except for the data.
That's not ideal, but I think I will rely on my proxy right now (for the cost of extra bandwidth) which send me back a sanitized JSON response.