Stackoverflow -> frontend - Allow access Cors missing acitx web + Sveltekit - Stack Overflow
I am writing a fullstack web app with actix-web and svelte, i just started writing the frontend and when i tried to implement login i got a CORS error:
Cross-Origin Request Blocked: The same-origin policy does not allow reading the remote resource from http://0.0.0.0:4000/login. (Cause: "Access-Control-Allow-Origin" CORS header is missing). Status code: 400.
I attached a
.wrap(cors) to the
App which makes the GET request to
/example work just fine but the POST request to
/login does not work (the code for the login function is on the stackoverflow page).
If i take out the Content-Type from the POST request it still returns 400 but it does not return a CORS error anymore.
The CORS setup can be seen on the stackoverflow page. I have researched quite a lot on this topic but i couldn't find anything that helped me with this.
If anyone has info or examples please share.
docs.rs does not count as an example since i followed it's instructions and it did not work.
You can also take a look at the Response recieved from actix-web on the stackoverflow page.
There you can see that actix-web provides almost no headers.