简体   繁体   English

Ajax通过API向HTTPS请求的问题

[英]Problems with Ajax request to HTTPS over API

I am trying to deploy my first React app through Heroku. 我正在尝试通过Heroku部署我的第一个React应用程序。 It works completely fine when running in local environment, but when I deploy it can't complete a request to The Movie DB API with the errors: 在本地环境中运行时,它可以很好地工作,但是当我部署它时,无法完成对Movie DB API的请求,并出现以下错误:

The page at 'https://boiling-escarpment-83243.herokuapp.com/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://api.themoviedb.org/3/genre/list?api_key='. This content should also be served over HTTPS.

and

{"status_code":7,"status_message":"Invalid API key: You must be granted a valid key."}

Again, there has been no trouble with the API key in local. 同样,本地的API密钥也没有问题。 Originally the base_uri in the package I am using points to an http URL, but I updated it to be https (and tested the https route and it seems to be supported: https://api.themoviedb.org/3/movie/550 ). 我最初使用的包中的base_uri指向http URL,但我将其更新为https(并测试了https路由,并且似乎受支持: https : //api.themoviedb.org/3/movie/550 )。 Here is my non-working app: https://boiling-escarpment-83243.herokuapp.com/ 这是我无法使用的应用程序: https : //boiling-escarpment-83243.herokuapp.com/

Silly question: did you update your request URL to https://api.themoviedb.org/3/movie/550 ? 愚蠢的问题:您是否将请求URL更新为https://api.themoviedb.org/3/movie/550 Looks like the request is still http://api.themoviedb.org/3/movie/550 . 看起来请求仍然是http://api.themoviedb.org/3/movie/550

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM