I will assume that you're a front-end developer only and that you don't have access to the backend of the application (regarding the tags of the question).
Short answer on how to properly solve this in your case? You can't, you'll need somebody else.
What is this about?
You need to understand that CORS is a security thing, it's not just here to annoy you just for fun.
It's purpose is to mainly prevent the usage of a (malicious) HTTP call from a non-whitelisted frontend to your backend with some critical mutation.
You could give a look to this YouTube video or any other one really, but I recommend a visual video because text-based explanations can be quite hard to understand.
You also need to understand that if you use Postman or any other tool to try your API call, you will not get the CORS issue. The reason being that those tools are not Web frontends but rather some server-based tools.
Hence, don't be surprised if something is working there but not in your Vue app, the context is different.
Now, how to solve this?
- Depending on the framework used by your backend team, the syntax may be quite different but overall, you'll need to tell them to provide something like
Access-Control-Allow-Origin: http://localhost:3000
(or any other port you'll be using).
PS: Using Access-Control-Allow-Origin: *
would be quite risky because it would allow anybody to access it, hence why a stricter rule is recommended.
- If you're using a service, like an API to send SMS, payment, some Google console or something else really, you'll need to allow your
localhost
in the dashboard of the service. Ask for credentials to your manager or Tech Lead.
- If you have access to the backend, you could it yourself as shown here (ExpressJS in this example): https://flaviocopes.com/cors/
How to hack it in a dirty way?
If you're in a damn hurry and want to get something really dirty, you could use a lot of various hacks a listed in the other answers, here's a quick list:
- use any extension who is able to create a middleware and forward the request to the backend (it will work because it's not directly coming from your frontend)
- force your browser to disable CORS, not sure how this would actually solve the issue
- use a proxy, if you're using Nuxt2, @nuxtjs/proxy is a popular one but any kind of proxy (even a real backend will do the job)
- any other hack related somehow to the 3 listed above...
In the end, solving the CORS issue can be done quite fast and easily. You only need to communicate with your team or find something on your side (if you have access to the backend/admin dashboard of some service).
I strongly recommend trying to get it right from the beginning because it's related to security and that it may be forgotten down the road...