I'm trying to make a cross-origin XMLHttpRequest
from within a web worker. The setup is as follows:
- The original request is made to the same domain
example.com
- The server redirects (302) the request to
s3.amazon.com
- S3 is properly set up for CORS, responding with the proper
Access-Control-Allow-Origin
header
The code is as follows:
var xhr = new XMLHttpRequest();
//this will redirect to 'https://s3.amazon.com/...'
xhr.open('GET', 'https://example.com/document/1234/download');
xhr.send(null);
Chrome, Firefox, Safari, and MS Edge on Win 10
This code properly follows the redirect, both when called from the main JS file and from a web worker.
IE 10/11 on Win 7
This code properly follows the redirect only when called from the main JS file. When called from a web worker, the request is aborted without an error or log message.
It's possible to make this work by editing the browser security settings and enabling "Access data sources across domains," but it is not viable to expect users to do so.
Questions
- Is there some special setup required to make IE 10/11 follow the redirect?
- Is there a way to get better output from IE 10/11 other than an opaque aborted request?