![](/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.