do you know what can cause the cors problem? When I worked on the project locally, there wasn’t any CORS error. Now when I deployed it live, I have the CORS error at fetching the data. If I understand it correctly, this is because the frontend app ist on example: https://myapp.com, and the backend is on https://myapp-backend.com. Also the problem comes from the backend side if I’m correct.
I tried some things what I found here stackowerflow’s posts. In the .htaccess file I added these lines:
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type, Authorization"
</IfModule>
in the vite confing I added these lines:
cors:{
"origin": "*",
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
"preflightContinue": false,
"optionsSuccessStatus": 204
}
I found some extensions for chorme, but they also didn’t work.
What else can I try to solve this CORS error?