我在iframe运行的另一个系统中编写了一个embed angularjs web。 问题是那些网站通过https强制要求所有内容。
所以我必须发出https请求。 当我宣布一个常量字符串url exp:
时,我注意到了angulajsangular.module('app.core')
.constant("AppConstants", {
"serverUrl": "https://example.com/web/rest/",
"imgUrl":'https://example.com/web/file/get?fileName=',
}
);
在模块中使用时:
var req = {
method: 'POST',
url: AppConstants.serverUrl + 'getMessage',
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
},
data: data
};
return $http(req);
我看它将调试转换为:https://example.com/web/rest/到http://example.com:443/web/rest/
所以我无法从我的iframe请求,因为它无法识别http://example.com:443是https请求,它会抛出错误:
ionic.bundle.min.js:117 Mixed Content:
The page at 'example.com' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint
'http://example.com:443/web/rest/getMessage'.
This request has been blocked; the content must be served over HTTPS.
请帮我解决这个案子!