Animatedradar call is hitting a cross-origin error

  • 2
  • Problem
  • Updated 2 years ago
  • (Edited)
I'm using an angular app to hook into the wunderground api.  Currently I have two GET requests:

------------------------
//GET forecast data...
$http.get("http://api.wunderground.com/api/******/forecast/hourly/alerts/conditions/q/OH/Columbus.jso...)    .then(function(response){
        console.log("Forecast Data:")
        console.log(response);
 });

    
//GET animated radar image
$http.get("http://api.wunderground.com/api/******/animatedradar/q/OH/Columbus.gif?newmaps=1&width...)    .then(function(response){
       console.log("Radar Data:");
       console.log(response); 
    });

-------------------------

The GET request for the forecast json data is working without problems.  

However I get a "No 'Access-Control-Allow-Origin' header is present on the requested resource." error for the animatedradar request, despite it being an almost identical request.  

What am I doing wrong?  Is the response-header for the images not configured correctly?

Console screenshot:

Photo of Zachary Schaffter

Zachary Schaffter

  • 2 Posts
  • 0 Reply Likes
  • frustrated

Posted 2 years ago

  • 2
Photo of FSDuncan

FSDuncan

  • 2 Posts
  • 0 Reply Likes
Did you ever find a solution to this?
Photo of Koni Kodes

Koni Kodes

  • 6 Posts
  • 0 Reply Likes
I'm still having that issue as well, regarding the city search. I would love to know the solution so that I can share my awesome program with the world.
Photo of Zachary Schaffter

Zachary Schaffter

  • 2 Posts
  • 0 Reply Likes
Unfortunately not.  I tried it from multiple setups and servers, multiple cities requested, etc, and in the end couldn't identify any issues on my end.

It seems like it's an issue on Wunderground's side of things, so until they fix the header on the animated radar response the request will continue to error out.
Photo of Koni Kodes

Koni Kodes

  • 6 Posts
  • 0 Reply Likes
So sad as this was my api of choice and now I can't use it. 
Photo of FSDuncan

FSDuncan

  • 2 Posts
  • 0 Reply Likes
It looks like you'd have to create a sort of proxy server to request from Wunderground's API, ignoring CORS, and then re-serve it to you with the correct headers. Has anyone reached out to the WU people directly to ask why they don't have CORS headers on their API responses? 
Photo of Koni Kodes

Koni Kodes

  • 6 Posts
  • 0 Reply Likes
They have never responded to my emails.
Perhaps they'll speak to you?