简体   繁体   中英

Problems with Ajax request to HTTPS over API

I am trying to deploy my first React app through Heroku. 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:

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. 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 ). Here is my non-working app: https://boiling-escarpment-83243.herokuapp.com/

Silly question: did you update your request URL to https://api.themoviedb.org/3/movie/550 ? Looks like the request is still http://api.themoviedb.org/3/movie/550 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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