,当我试图从一个JavaScript文件位于完全相同的域中的Web服务,使一个XMLHTT prequest,我得到它是如何可能的:
产地 http://mydomain.com 不受访问控制 - 允许 - 产地???
如果我改变mydomain.com为localhost,我不再有问题,但我想保持它为mydomain.com
我有什么修改,为什么摆在首位,因为它是同一个域?
解决方案 1)在你的请求/响应头的样子。是服务器返回一个奇怪的的访问控制,允许原产地
头?
2)这不只是域,它也是协议(HTTP VS HTTPS VS FTP等),端口(如果你有一个:8080或类似的东西),和潜在的后部分的.com /
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 allowed by Access-Control-Allow-Origin ???
If I change mydomain.com to localhost, I no longer have problems, but I would like to keep it as mydomain.com
What do I have to edit, and why in the first place, since it's the same domain?
解决方案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/