1

login:1

Access to XMLHttpRequest at 'http://localhost:8080/Backend/users/signin' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

enter image description here

suggested adding CORS configuration in the backend code to allow requests from the frontend application running at http://localhost:4200.

I provided a code example for the CORS configuration in Java using Spring Boot.

I suggested checking if the CORS configuration is correctly applied and loaded in the application, and also ensuring that the server is restarted after making changes.

I advised verifying that the backend server responds with the correct CORS headers, including the Access-Control-Allow-Origin header with the value 'http://localhost:4200'.

I recommended checking for any conflicts with other proxy or CORS configurations if using Angular CLI and proxy.conf.json.

I advised checking the server logs for any errors related to CORS requests.

The Fabio
  • 5,369
  • 1
  • 25
  • 55
  • Oui, cela répond partiellement à la question sur l'activation de CORS dans Spring Boot. Cependant, il semble qu'il y ait encore des problèmes liés à CORS qui ne sont pas résolus – Khitem MATHLOUTHI Jul 25 '23 at 13:04
  • You might want to write in English... – The Fabio Jul 25 '23 at 13:07
  • Yes, this partially answers the question about enabling CORS in Spring Boot. However, it seems that there are still some CORS related issues that are unresolved – Khitem MATHLOUTHI Jul 25 '23 at 13:22
  • "Access to XMLHttpRequest at 'http://localhost:8080/Backend/users/signin' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource." – Khitem MATHLOUTHI Jul 25 '23 at 13:28

0 Answers0