axios in firefox
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.
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.
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 ?
@eloy-silva It will have something to do with your api server.
The two browsers are not quite identical the way they handle this.
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:
In the context of Quasar, which is amazing technology, on dev machines we should use a devServer configuration in quasar.conf.js:
This is essentially a webpack devserver so we could use the proxy to access the API from dev machine:
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.