我有一个休息服务(作为 Azure 函数实现),在 HTTPS 上运行,在域 A 上。
我有一个网站,在域 B 的 HTTPS 上运行。
我为 cors 指定了通配符 *。
在网站上使用 jQuery,我将 Ajax 请求发送到其余服务。这有效,我可以看到我的GET请求由OPTIONS.
当我开发我的休息服务时,我想在本地托管服务,在 HTTP 上运行,在 localhost 域上。这似乎不起作用。
我必须启用混合内容,但浏览器 (Firefox) 似乎没有发送或预检我的请求 - 网络流量为空。看起来我的请求未能通过 CORS 请求。
这出现在 Firefox 控制台中。
16:42:56.550 Loading mixed (insecure) active content "http://locahost:7071/api/test/get?message=get+hello+world!" on a secure page[Learn More] ajax.ts:153:23
16:42:56.558 Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://locahost:7071/api/test/get?message=get+hello+world!. (Reason: CORS request did not succeed).
我可以通过将我的本地 url 设置为来避免混合内容错误//locahost,但是这仍然会导致 CORS 失败。
这是因为我试图从 HTTPS 域到 HTTP localhost 执行 CORS 吗?







