cors-anywhere
cors-anywhere copied to clipboard
Cors Anywhere doesn't work on IE/Chrome
So I deployed own CORS Anywhere server locally with no any changes. Running CORS Anywhere on 0.0.0.0:8080
My simple client side script:
var username = 'user';
var password = 'passwd';
var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://10.20.147.5:8080/http://remoteIP:port/rest/config/v1/box/firewall/rules');
xhr.setRequestHeader('Authorization', 'Basic ' + btoa(username + ':' + password));
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
xhr.onload = function() {
alert(xhr.status + ' ' + xhr.statusText + '\n\n' + xhr.responseText);
};
xhr.send();
This works without any problem on Firefox but doesnt on Internet Explorer and Chrome at all. Javascripts are enabled on browser. I receive following error on IE developer console: XMLHttpRequest: Network Error 0x800c0007, No data is available for the requested resource.
Thank you, Stefan
What is the error in Chrome? Please capture the request via chrome://net-export and share it with me, either via an attachment here or by e-mail.
I'd like to see the original response headers of http://remoteIP:port/ to start with.
Attached as requested, for chrome I see below error: Failed to load resource: net::ERR_CONNECTION_TIMED_OUT
Which is strange as I can reach the API from web server or using Firefox.
Thank you.
I don't see any response headers in the exported logs. Did you stop capturing the log before the request completed?
Please attach a log that includes the response headers.
If you are unable to create the information with Chrome, consider generating a packet capture with Wireshark (and mail it to me, since it may contain information that you shouldn't share in public).
Hello, attaching new export from chrome, I refreshed the page few time so you may see some duplicit entries.
There is never a succesful response to the request in your log.
Are you able to load http://10.20.147.5:8080/ in Chrome? (directly visiting it, not through XMLHttpRequest).
Are you able to load http://10.20.147.5:8080/dummy in Chrome? (through XMLHttpRequest; the response should have HTTP status 404 and "Invalid host: dummy").
Are you able to load http://10.20.147.5:8080/http://example.com/ in Chrome? (through XMLHttpRequest).