使用仅通过HTTPS网站的HTTP的开放天气地图,而不是混合内容警告 [英] Using Open Weather Map which is HTTP only through an HTTPS website and NOT get mixed content warning

查看:151
本文介绍了使用仅通过HTTPS网站的HTTP的开放天气地图,而不是混合内容警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SO上查看了此链接:在HTTPS中处理HTTP内容页面

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

我从这里开始尝试这个开放协议: http://benpowell.org/https-and-http-the-protocol-less-or-protocol-relative-urls/

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

但我只有一次调用openoutmap的HTTP网址,它不通过HTTPS提供内容,除非你支付500 / mo。不能这样做。

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.

所以,我需要找到一种方法来为OpenWeatherMap引入HTTP内容,而不是在任何上生成混合内容错误消息浏览器。

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.

以下是OWM的API调用: http://api.openweathermap.org/data/2.5/weather?lat=32.22&lon=-100.50&APPID=c6fdcf2d49a0bba3e14f310bd3d5cdc2

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

任何想法,任何人?

提前谢谢。

推荐答案

在使用Open Weather Map API尝试将我的应用程序托管在heroku上时偶然发现此线程。

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

把它放在网址前面:


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

以便url becom es

so that the url becomes


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

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

再次检查您的申请并注意openweather网址是否为http(其方式为最初)!这个解决方案对我有用,虽然CORS解决方案可能不会永远持续下去。

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.

这篇关于使用仅通过HTTPS网站的HTTP的开放天气地图,而不是混合内容警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆