11 Feb

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.


Posted by on February 11, 2011 in HTTP


10 responses to “Access-Control-Allow-Origin

  1. Royce

    March 23, 2011 at 10:51 am


    I meet the same problem, how could you deal with this Access-Control-Allow-Origin problem?

  2. Mete

    March 23, 2011 at 12:13 pm

    Here’s some good info on the problem and how to handle it:

  3. Juan at Bangkok

    April 18, 2011 at 8:41 am

    Got the same problem. @Mete thanks for the link

  4. mayooresan

    January 13, 2012 at 11:55 am

    This problem is killing me :(

  5. funivan

    January 13, 2012 at 12:21 pm

    just google HTTP access control =)

  6. hharnisc

    January 14, 2012 at 6:28 pm

    I fixed this using jsonp call. I used jquery.getJSON see: and if you look in the spec it will do jsonp call if you add “callback=?” in the url string

  7. 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

  8. 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’}

  9. murali

    February 21, 2014 at 10:27 am

    i hate this one…can u any one tell me the solution for these


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: