Today, I got this error in Chrome as I was trying to make a HTTP request from localhost:8400 to localhost:2081:
XMLHttpRequest cannot load http://localhost:2080. Origin http://localhost:8400 is not allowed by Access-Control-Allow-Origin.
I know about Cross-site requests and I’m aware the reasons behind disallowing it but I’m a little surprised that these limitations apply to the same domains but different ports.


Royce
March 23, 2011 at 10:51 am
Hi,
I meet the same problem, how could you deal with this Access-Control-Allow-Origin problem?
Mete
March 23, 2011 at 12:13 pm
Here’s some good info on the problem and how to handle it:
https://developer.mozilla.org/En/HTTP_Access_Control
Juan at Bangkok
April 18, 2011 at 8:41 am
Got the same problem. @Mete thanks for the link
mayooresan
January 13, 2012 at 11:55 am
This problem is killing me
funivan
January 13, 2012 at 12:21 pm
just google HTTP access control =)
hharnisc
January 14, 2012 at 6:28 pm
I fixed this using jsonp call. I used jquery.getJSON see: http://api.jquery.com/jQuery.getJSON/ and if you look in the spec it will do jsonp call if you add “callback=?” in the url string
Raphael
March 18, 2012 at 5:56 pm
hharnisc thanks a lot, forgot to add a ‘magic’ string at the end like callback=? and it works fine now:) thanks once again
DotProductSoftware
April 3, 2012 at 1:02 pm
Return “Access-Control-Allow-Origin:http://some/domain/here” in your headers.
I’m using NodeJS and I have to write this “response.writeHead(200,{‘Content-type’:'text/javascript’,'Access-Control-Allow-Origin’:'http://url_here’}