0
votes

I tried deploying a Heroku web app with my Flask backend (not on Heroku, actually on GCP) and got the following message in my browser's dev console:

Mixed Content: The page at 'https://x.herokuapp.com/' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://x:5000/endpoint'. This request has been blocked; the content must be served over HTTPS.

I have little experience with serving and SSL, but the first temptation here would be to find a way to make Heroku okay with using http endpoints. And I'd love to avoid setting up SSL if possible.

What are my options from here?

Thanks!

1
To which service did you deploy your heroku app? App Engine? I'm assuming (!?) that the referenced page is within the same app (because both hosts are x). You definitely want to (continue to) use TLS (HTTPS) but, e.g. App Engine can help with this. Assuming x:5000 is a reference within the heroku app, you should drop the http:// and the x (the reference should just be a relative /endpoint) and you should run Flask on (App Engine's preferred) port 8080 rather than 5000.DazWilkin
I deployed it in Heroku. Thanks for your advice. Actually I realised that if I apply my own domain name it won't use https (unless I tell it to). So now my frontend is http, meaning my backend can stay http as wellAlexander Soare
So, you solved this issue by switching to HTTP, am I right?Serhii Rohoza
@SerhiiRohoza correctAlexander Soare
Thanks! Please post it as an answer instead of comment.Serhii Rohoza

1 Answers

1
votes

In the end I realised that by applying my own http domain to the project (rather than using Heroku's domain), I am able to avoid the issue.

Then with http on the frontend, I was able to call http endpoints from my GCP server.