Read the statement by Michael Teeuw here.
CORS policy
-
Hi all,
Upon loading my magicmirror today, I’ve been met with an issue in relation to the default weather module, starting in dev mode has shown me the error
access to xmlhttprequest at from origin has been blocked by cors policy the access control allow origin header contains multiple values ‘*, *’ but only one is allowed
after googling, and seeing the results, it’s way above my (non-existent) technical know-how.
Is anyone able to shed any light (in lay man’s terms)?
Thanks,
-
@bicolorbore586 use the develop branch. they have just reworked all the weather providers to handle this.
see
https://forum.magicmirror.builders/topic/14327/testing-new-fixes-or-solving-current-problems-with-next-release-code -
@sdetweil
I’ve tried to do that, now get pretty much the same result, but with a slightly different bit at the end.Access to fetch at ‘https://api.weatherbit.io/v2.0/forecast/daily?lat=xxx&lon=-xxx&units=M&key=a…’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header contains multiple values ‘*, *’, but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
api.weatherbit.io/v2…:1
Failed to load resource: net::ERR_FAILED
weatherbit.js:66 Could not load data … TypeError: Failed to fetch
at Class.fetchData (weatherprovider.js:136:27)
at Class.fetchWeatherForecast (weatherbit.js:53:8)
at weather.js:184:27
weather.js:150 New weather information available.
localhost/:1 Refused to apply style from ‘http://localhost:8080/css/custom.css’ because its MIME type (‘text/html’) is not a supported stylesheet MIME type, and strict MIME checking is enabled. -
@bicolorbore586 did u git pull, npm install after switch
-
@sdetweil yes, followed your instructions to the letter
-
@bicolorbore586 custom.css is because it doesn’t exist by default. if u used my install script I create it for you
touch ~/MagicMirror/css/custom.css
-
@sdetweil I used the MagicMirror installation instructions (assuming manual install) to install the software.
Have just tried your git fetch origin
But get fatal: Refusing to fetch into current branch refs/heads/develop of none-bare repository.(Sorry, you’re probably shaking your head, but I am a complete noob at all this)
-
@bicolorbore586 there were two choices
manual install
git checkout develop
git pull
npm installor the other
-
I think the cors proxy is not new in the weather module (but in newsfeed) so last release should work.
The cors proxy was not enabled for all weather providers, only for
envcanada
anddarksky
, so it must be enabled in the config forweatherbit
by addinguseCorsProxy: true,
to the weather config. -
@karsten13 ah, I thought we went proxy everywhere