Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Adam Beer
Adam Beer
11,314 Points

React and Heroku

Hi everybody!

I deployed my React app to Heroku but I get an error in the console, and my app doesn't running. This is the error message.

Mixed Content: The page at 'https://omdb-api-react.herokuapp.com/' was loaded over HTTPS, but requested an insecure resource 'http://www.omdbapi.com/?s=Star%20Wars&apikey=your-private-key'. This request has been blocked; the content must be served over HTTPS.

I tried rewrite my PORT in the scripts inside the package.json file, but it doesn't work

"scripts": {
    "start": "set PORT=https://omdb-api-react.herokuapp.com/ && react-scripts start",
    ....

or I tried the other way but the error is still same, and the app doesn't load.

"scripts": {
    "start": "cross-env PORT=https://omdb-api-react.herokuapp.com/ react-scripts start",
}

Any idea how can I solve this problem? I'm working on Windows. I've never used the Heroku. And to my React app I used create-react-app. Thanks the helps!

Have a nice day!

1 Answer

Seth Kroger
Seth Kroger
56,413 Points

This isn't a Heroku issue per se, but due to the fact you're trying to use both HTTP and HTTPS in the same page and running into a browser security issue. You may want to check out this resource: https://developers.google.com/web/fundamentals/security/prevent-mixed-content/fixing-mixed-content

Adam Beer
Adam Beer
11,314 Points

Thank you Seth!