在同一个域访问控制 - 允许 - 原产地问题 [英] Access-Control-Allow-Origin problems on the same domain
问题描述
,当我试图从一个JavaScript文件位于完全相同的域中的Web服务,使一个XMLHTT prequest,我得到它是如何可能的:
产地 http://mydomain.com 不受访问控制 - 允许 - 产地??? <允许/ P>
如果我改变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/
这篇关于在同一个域访问控制 - 允许 - 原产地问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!