I am trying to configure cors access to my project, since when making a request to an api it is blocked and gives me the following error in the console:
cross-origin request blocked the same origin policy disallows reading the remote resource at https://geo.ipify.org/api/v2/... //my api key and the ip
I tried to set up a proxy server but it still won't let me.
Here the configuration of the proxy server:
export default defineConfig({
server: {
proxy: {
"/api": {
target: "https://geo.ipify.org/api/v2",
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^/api/, ""),
},
},
},
plugins: [react()]
})
Thanks.