access-control-allow-origin 中的相同域是什么
What's the same domain in access-control-allow-origin
我在 IE 中有一个错误,它是 origin not found in access-control-allow-origin header
,它在 Chrome 中运行良好。
我用Ajax访问了这个域名下的url
最后发现是因为地址栏的url。如果我在Chrome中输入aa.com
,它变成了http://www.aa.com
,但在IE中,它是http://aa.com
。
这是我不明白的地方。他们没有相同的域 (aa.com
) 吗?为什么会出现这个错误?
如果有人能提供帮助,在此先感谢。
来源根本不是基于域。
Two pages have the same origin if the protocol, port (if one is specified), and host are the same for both pages.
—MDN
避免在多个主机名上托管同一个网站。它有很多缺点。选择其中之一作为规范并将所有其他人重定向到它。
也尝试使用相对 URL 而不是绝对 URL。
Finally, I found that it's because the url in address bar. If I enter aa.com in Chrome, it's turned to http://www.aa.com
, but in IE, it's http://aa.com
.
这不是正常行为。他们很可能会自动完成您历史记录中的不同 URL,而不是更改您实际输入的内容。
我在 IE 中有一个错误,它是 origin not found in access-control-allow-origin header
,它在 Chrome 中运行良好。
我用Ajax访问了这个域名下的url
最后发现是因为地址栏的url。如果我在Chrome中输入aa.com
,它变成了http://www.aa.com
,但在IE中,它是http://aa.com
。
这是我不明白的地方。他们没有相同的域 (aa.com
) 吗?为什么会出现这个错误?
如果有人能提供帮助,在此先感谢。
来源根本不是基于域。
Two pages have the same origin if the protocol, port (if one is specified), and host are the same for both pages.
—MDN
避免在多个主机名上托管同一个网站。它有很多缺点。选择其中之一作为规范并将所有其他人重定向到它。
也尝试使用相对 URL 而不是绝对 URL。
Finally, I found that it's because the url in address bar. If I enter aa.com in Chrome, it's turned to
http://www.aa.com
, but in IE, it'shttp://aa.com
.
这不是正常行为。他们很可能会自动完成您历史记录中的不同 URL,而不是更改您实际输入的内容。