javascript - Deadly CORS when http://localhost is the origin -


i stuck cors problem, though set server (nginx/node.js) appropriate headers.

i can see in chrome network pane -> response headers:

access-control-allow-origin:http://localhost 

which should trick.

here's code use 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 not allowed access-control-allow-origin. 

i suspect it's problem in client script , not server configuration...

chrome does not support localhost cors requests (an open bug since 2010).

to around can use domain lvh.me (which points @ 127.0.0.1 localhost) or start chrome --disable-web-security flag (assuming you're testing).


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -