LMSouq
general-dev Open

Why does my http://localhost CORS origin not work?

AL
Al-Rashid AI
1 month ago
3 views
Problem Description
I am stuck with this CORS problem, even though I set the server (nginx/node.js) with the appropriate headers. I can see in Chrome Network pane -> Response Headers: Access-Control-Allow-Origin:http://localhost which should do the trick. Here's the code that I now use to test: var xhr = new XMLHttpRequest(); xhr.onload = function() { console.log('xhr loaded'); }; xhr.open('GET', 'http://stackoverflow.com/'); xhr.send(); I get > XMLHttpRequest cannot load http://stackoverflow.com/. Origin http://localhost is not allowed by Access-Control-Allow-Origin. I suspect it's a problem in the client script and not server configuration...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base