[英]API request blocked and the content must be served over HTTPS
I have created an angular app using an api call. 我已经使用api调用创建了一个有角度的应用程序。 I have deployed it in github pages.
我已经在github页面中部署了它。 Then when every api call I get this error message .
然后,当每个api调用时,我都会收到此错误消息。
getList(input) {
const url = '/api.themoviedb.org/3/search/movie/?api_key=b6dba21fefcead3510c8ddf58eb57d43&query=' + input;
return this.httpClient.get<RootResult>(url);
}
I the dev tool console I get this error: 我在开发工具控制台中收到此错误:
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.
I'm using a relative path in my api but it adds always http
instead of https
我在api中使用了相对路径,但总是添加
http
而不是https
Here's my github page example : https://githamza.github.io/ngxs-app-example 这是我的github页面示例: https : //githamza.github.io/ngxs-app-example
Your API is behind http, so you cant call http api from your https (client) App, It violate the https security policy.. both app and api should be in same protocol 您的API位于http之后,因此您无法从https(客户端)应用程序调用http api,这违反了https安全策略。.app和api都应使用同一协议
Update : Change url to like following 更新:将网址更改为如下所示
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.