Skip to content Skip to sidebar Skip to footer

Access-control-allow-origin Problems On The Same Domain

How is it possible that when I try to make an XMLHTTPRequest from a javascript file to a web service located on the very same domain, I get: Origin http://mydomain.com is not allow

Solution 1:

It probably is because of the missing www. If you test with yourdomain.com and your site is at www.yourdomain.com it is concidered cross-domain and cross-domain calls are not allowed by default.

Solution 2:

1) look in your request/response headers. Is the server returning a weird access-control-allow-origin header?

2) It's not just the domain, it's also the protocol (http vs https vs ftp etc), the port (if you have a :8080 or something like that), and potentially the part after the .com/

Post a Comment for "Access-control-allow-origin Problems On The Same Domain"