CORS ERROR
I have an issue in my project, I understand the error, as well as I tried to find answer for it but no luck so far.
Here is my scenario:
- I have nuxt 3 app, where I am embedding one of the vue component.
- That component is a chatbot, where user can ask some question to it.
- I have no control or no way to access method or API call it make to get chat response, which is giving me error as, that api call origin is different.
How can I solve this cors error?
My app is running on localhost:3000
and request are made by that component is something like https://part1.part2.part3.origin.com/log
and https://part1.part2.part3.origin.com/api/chat
I have this config in nuxt.config.js
file:
vite: {
server: {
proxy: {
'/APPWEB/': {
target: 'http://localhost',
changeOrigin: true,
secure: false
},
'/APPWEB/Lib/': {
target: 'http://localhost',
changeOrigin: true,
secure: false
}
}
}
}
My backend is running on localhost.
What above proxy code is doing is that, for endpoint /APPWEB/
and /APPWEN/Lib/
it will redirect those request to localhost.
I don’t have anything in server
folder of my Nuxt project.
Please guide me how to solve this issue and if needed please update question title.
Error screenshot
6