Open weather API Mixed content

Open weather API Mixed content
0

#1

Hello, I’m running into a mixed content issue on the weather project? Is there a way to get around this without using a 3rd party service like cors-everywhere did not seem to work for me?

Here is what i have so far.

Any suggestions are appreciated. Thanks!


#2

It’s like catch-22. Some API requires you to use https to get Lat/Lng/etc. but if you do, open weather map doesn’t work because the free version uses only http. So you have to access the weather API via https. Like this:

https://cors-anywhere.herokuapp.com/http://api.openweathermap.org/data/2.5/weather"

Here’s my weather app
https://weather-owel.surge.sh/


#3

This seemed to work. Is it normal to have to do this if the project was hosted on your own server? Or would you have more control over the protocol method?

Thanks! :smiley:


#4

It’s not about whose server, but it’s about the http connection. A lot of websites now require https connection if you want to access their API (ex: Google maps). The problem is you’re using API services from different companies and can’t mix both https and http calls, because now the http call wouldn’t work.

The weather API would work using an https connection if you have the paid account. The free account only allows http connection.


#5

oh gotcha. Thanks for the help. I appreciate it. :relaxed: