Cors issues
See original GitHub issueHi, I’m trying to proxy some requests during development to avoid cors issues but getting this error:
Access to XMLHttpRequest at 'https://gateway.boaconsulta.com/api/v1/cep/01322-050' (redirected from 'http://localhost:3000/cep/01322-050') from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
My nuxt.config.js is configured as follow:
axios: {
proxy: true
},
proxy: {
'/cep/': { target: 'http://gateway.boaconsulta.com/api/v1/' }
},
I’m calling the service this way on the client side:
async resolveCep () {
await this.$axios.get(`/cep/${this.data.zip}`)
}
I see on Chrome devtools the origin header to the target url is still http://localhost:3000
, but the changeOrigin
option isn’t about rewrite the origin header to the target url?
What I’m doing wrong?
Appreciate any help.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Cross-Origin Resource Sharing (CORS) - MDN Web Docs
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, ...
Read more >A Guide to Solving Those Mystifying CORS Issues
An 'issue with CORS' occurs when the API does not reply to such request with, 'Yes, dear browser, you are allowed to do...
Read more >What is CORS (cross-origin resource sharing)?
Vulnerabilities arising from CORS configuration issues · Server-generated ACAO header from client-specified Origin header · Errors parsing Origin headers.
Read more >CORS errors and how to solve them
Or, your API fails and shows a CORS error in the console. · This happens because the same-origin policy is part of the...
Read more >What Is a CORS Error and How to Fix It (3 Ways)
As a CORS error occurs when the external API server doesn't return the HTTP headers required by the CORS standard, you can add...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
sorry, my bad
oh ok! I accept it is very shameful to post the solution but the problem for me solved with changing
to
*** notice deleting / from end of url 😃