MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    CORS policy

    Scheduled Pinned Locked Moved Solved Troubleshooting
    20 Posts 3 Posters 3.4k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      bicolorbore586
      last edited by

      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,

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @bicolorbore586
        last edited by

        @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

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        B 1 Reply Last reply Reply Quote 0
        • B Offline
          bicolorbore586 @sdetweil
          last edited by

          @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.

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @bicolorbore586
            last edited by

            @bicolorbore586 did u git pull, npm install after switch

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            B 1 Reply Last reply Reply Quote 0
            • B Offline
              bicolorbore586 @sdetweil
              last edited by

              @sdetweil yes, followed your instructions to the letter

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @bicolorbore586
                last edited by

                @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

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                B 1 Reply Last reply Reply Quote 0
                • B Offline
                  bicolorbore586 @sdetweil
                  last edited by

                  @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)

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    sdetweil @bicolorbore586
                    last edited by

                    @bicolorbore586 there were two choices

                    manual install

                    git checkout develop
                    git pull
                    npm install

                    or the other

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    karsten13K 1 Reply Last reply Reply Quote 0
                    • karsten13K Offline
                      karsten13 @sdetweil
                      last edited by

                      @sdetweil

                      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 and darksky, so it must be enabled in the config for weatherbit by adding useCorsProxy: true, to the weather config.

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        sdetweil @karsten13
                        last edited by

                        @karsten13 ah, I thought we went proxy everywhere

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        karsten13K 1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy