Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Open Weather Map which is HTTP only through an HTTPS website and NOT get mixed content warning

Tags:

http

https

ssl

I checked out this link here on SO: Dealing with HTTP content in HTTPS pages

I tried this regarding open protocols from here: http://benpowell.org/https-and-http-the-protocol-less-or-protocol-relative-urls/

But I have only one call to an HTTP url for openweathermap which does not serve up it's content via HTTPS, unless you pay them 500/mo. Can't do it.

So, I need to find a way to bring in the HTTP content for OpenWeatherMap and not generate the "mixed content" error message on "any" browser.

Here's the API call for OWM: http://api.openweathermap.org/data/2.5/weather?lat=32.22&lon=-100.50&APPID=c6fdcf2d49a0bba3e14f310bd3d5cdc2

Any thoughts, anyone?

Thanks, in advance.

like image 586
Peter The Angular Dude Avatar asked Jul 19 '14 22:07

Peter The Angular Dude


1 Answers

Stumbled upon this thread while trying to get my application hosted on heroku while using the Open Weather Map API.

Put this in front of the url:

https://cors-anywhere.herokuapp.com/

so that the url becomes

https://cors-anywhere.herokuapp.com/http://api.openweathermap.org/data/2.5/forecast? appid=${API_KEY}

Check your application again and note that the openweather url is http again (the way it was originally)! This solution worked for me, although the CORS solution may not last forever.

like image 93
j0shyap Avatar answered Oct 05 '22 07:10

j0shyap