简体   繁体   English

API请求被阻止,内容必须通过HTTPS提供

[英]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.

相关问题 在https上阻止了Angular templateUrl。 内容必须通过HTTPS提供。” - Angular templateUrl blocked on https “This request has been blocked; the content must be served over HTTPS.” Chrome扩展程序出错-“混合内容:此请求已被阻止; 内容必须通过HTTPS投放” - Error with Chrome extension - “Mixed Content: This request has been blocked; the content must be served over HTTPS” 如何解决此请求已被阻止; 内容必须通过 HTTPS 提供 - how to solve This request has been blocked; the content must be served over HTTPS 混合错误:此请求已被阻止; 内容必须通过 HTTPS 提供 - Mixed Error: This request has been blocked; the content must be served over HTTPS Codeigniter - jquery.min.js:4 混合内容:内容必须通过 HTTPS 提供 - Codeigniter - jquery.min.js:4 Mixed Content: the content must be served over HTTPS API 数据超过 http 在通过 https 提供服务的站点中,脚本有“混合内容”错误 - API data over http in site served over https, script has “mixed content” error Javascript google 音译 API 不通过 h​​ttps 提供 - Javascript google transliterate API not served over https 混合内容 jQuery ajax HTTPS 请求已在 Laravel 上被阻止 - Mixed content jQuery ajax HTTPS request has been blocked on Laravel 已阻止通过安全连接将地理位置混合访问到https:// localhost:3000,无法访问地理位置 - blocked Access to geolocation was blocked over secure connection with mixed content to https://localhost:3000 Deezer内容通过HTTP提供 - Deezer content is served over HTTP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM