No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    axios in firefox

    Help
    4
    6
    509
    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.
    • E
      eloy.silva last edited by

      when i use axios in google chrome everything works fine but when i use firefox i get this message

      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:44355/api/auth/Login. (Reason: CORS request did not succeed)
      

      I don’t understand.

      😰

      1 Reply Last reply Reply Quote 0
      • metalsadman
        metalsadman last edited by metalsadman

        this is not quasar specific, it means you need to allow CORS in your backend api. googling will help you with this.

        E 1 Reply Last reply Reply Quote 0
        • E
          eloy.silva @metalsadman last edited by

          @metalsadman said in axios in firefox:

          this is now quasar specific, it means you need to allow CORS in your backend api. googling will help you with this.

          in my api, cors are enabled

          why in chrome it works and in firefox it doesn’t work ?

          1 Reply Last reply Reply Quote 0
          • T
            turigeza last edited by

            @eloy-silva It will have something to do with your api server.
            https://stackoverflow.com/questions/51831652/cors-request-did-not-succeed-on-firefox-but-works-on-chrome

            The two browsers are not quite identical the way they handle this.

            1 Reply Last reply Reply Quote 0
            • qyloxe
              qyloxe last edited by qyloxe

              CORS is counterintuitive at first, but it is one of the most important technologies in terms of API security. You should understand not only what is needed from you to send some requests from client to server, but also, what benefits the CORS could give to you.

              This is VERY nice interactive tutorial - worth checking:
              https://httptoolkit.tech/will-it-cors/

              In the context of Quasar, which is amazing technology, on dev machines we should use a devServer configuration in quasar.conf.js:

              https://quasar.dev/quasar-cli/quasar-conf-js#Options-to-Configure

              This is essentially a webpack devserver so we could use the proxy to access the API from dev machine:

              https://webpack.js.org/configuration/dev-server/#devserverproxy

              In stage/qa and production environment it is also recommended to use reverse proxy with API endpoints, so yours dev configuration should be very similar to what you use in productions. In terms of quasar/axios, thanks to webpack devserver proxy, you can have just one code accesing your API as for example /api/v1/something/params/etc

              Oh, and about differences in chrome/firefox - CORS uses some kind of timeout and browser could cache pre-flight requests so, if you really want to check a difference, you should open a new incognito windows in both browsers and check the operation in those windows once, and then close them, before next test.

              1 Reply Last reply Reply Quote 0
              • E
                eloy.silva last edited by

                https://github.com/axios/axios/issues/2155?fbclid=IwAR3h93iDxEpxwUBNR5UgU6KeGcE0x3I0NgT0Q1soPfKVD8Hqo2Vh-OiS6Sw

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post