![](/img/trans.png)
[英]Angular templateUrl blocked on https “This request has been blocked; the content must be served over HTTPS.”
[英]API request blocked and the content must be served over HTTPS
我已经使用api调用创建了一个有角度的应用程序。 我已经在github页面中部署了它。 然后,当每个api调用时,我都会收到此错误消息。
getList(input) {
const url = '/api.themoviedb.org/3/search/movie/?api_key=b6dba21fefcead3510c8ddf58eb57d43&query=' + input;
return this.httpClient.get<RootResult>(url);
}
我在开发工具控制台中收到此错误:
Mixed Content: The page at 'https://githamza.github.io/ngxs-app-example/home' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.themoviedb.org/3/search/movie?api_key=b6dba21fefcead3510c8ddf58eb57d43&query=l'. This request has been blocked; the content must be served over HTTPS.
我在api中使用了相对路径,但总是添加http
而不是https
这是我的github页面示例: https : //githamza.github.io/ngxs-app-example
您的API位于http之后,因此您无法从https(客户端)应用程序调用http api,这违反了https安全策略。.app和api都应使用同一协议
更新:将网址更改为如下所示
const url = 'https://api.themoviedb.org/3/search/movie/?api_key=b6dba21fefcead3510c8ddf58eb57d43&query=' + input;
使用https!
const url = 'https://api.themoviedb.org/3/search/movie/?api_key=b6dba21fefcead3510c8ddf58eb57d43&query=' + input;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.