Replies: 1 comment
-
CORS matches origins; it doesn't matter if they're both sibling subdomains, if origin A !== origin B, you need to deal with CORS.
Keep in mind the proxy is only going to run in dev, as you won't be running the Vite server in prod.
CORS only triggers cross origin, as the name indicates -- for example, https://vworld.domain.io trying to send a request to https://api.domain.io. Accessing https://api.domain.io through your browser or postman ignores CORS entirely, as it's not cross origin. CORS also isn't implemented outside of any browser to my knowledge, so postman will never report an error in that regard. You should configure CORS on your API, whitelisting the web app. |
Beta Was this translation helpful? Give feedback.
-
I'm using react vite and attempting to call an api in the same server and im getting cors errors, so I added a proxy which didnt work and the requests are not being redirected to api.domain.io instead they get sent to vworld.historiar.io which is the frontend url. The API is accessible both on the browser and postman so the problem is purely from vite:
vite.config.js :
Beta Was this translation helpful? Give feedback.
All reactions