Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
798 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...