Solve the CORS error with Spring Security and a React frontend.
Вставка
- Опубліковано 20 січ 2024
- In this video, I solve the CORS error using Spring Security. I use a React frontend to test my application and see when the CORS error is solved. There is a difference when solving the CORS error within the Spring Security instead of the WebMvcConfigurer.
The CORS error appears when a frontend tries to access a backend with a different URL. To solve this problem, I must configure my backend to accept a frontend from a different URL. I can also specify which HTTP methods are accepted and which HTTP Headers.
For more details about solving the CORS error with WebMvcConfigurer, check this video: • Solution of the Cors E...
This video belongs to a playlist where I develop fullstack applications using a frontend and a backend in Spring Boot: • How to Easily Secure Y...
My NEW eBook: sergiolema.dev/git-book/
Github project: github.com/serlesen/fullstack...
Blog: bit.ly/47ornJL
LinkedIn: bit.ly/41Nn61q
Facebook: bit.ly/47rc9nh
My Desktop:
• Laptop: Macbook Pro 16' 2019
• Gaming Chair: amzn.to/47Vu6ed
• Mouse: amzn.to/3HoBwM1
• Desk: amzn.to/48Tc5Oi
• Screen: amzn.to/48VZkCL - Наука та технологія
Thanks for uploading this, buddy! Awesome content
You're welcome Tyler!
Thank you and your videos, they helped complete my pet project. Thanks to your spring security+react and cors tutorials, I was finally able to figure out how it works
I'm so glad it helped you!
The best tutorial I found and it worked!
Thank you so much and keep doing what you doing🔥💯
I'm so happy for you!
Thanks a lot for clean and great tutorial.
Thanks for watching Muhammed!
Ótima explicação 👏👏, ajudou muito, muito obrigado.
You're welcome Felipe!
saved my day, thank you!!!
You're welcome
Thanks. Is there any difference between using this or using WebMvcConfigurer?
If you use Spring Security, it's recommended to use this way instead of WebMvcConfigurer.
This way, a CorsFilter is put in place which intercepts all the requests.
With WebMvcConfigurer, not all the requests are intercepted, only those from the MVC Web.
Thank you, for your Videos !! Do you have any good sources with clear explanations of WebFlux in Java? I haven't worked with reactive programming before, and now I'm having some trouble understanding how to write good code with WebFlux. I would really appreciate it
I've done nothing with WebFlux.
Maybe I will prepare something soon as I see many requests.
@@TheDevWorldbySergioLema thank you
Thank u very much, i am working on a spring boot and Angular Project and had the same Problem with Cors. I have already implement the configuration this way which is works locally, but when i deploy my spring boot on Server and try to test my angular app i get 403!!
so locally it works fine but on network i get the 403!
Can u help me with this issue?
The accepted origin URL must be adapted to your local environment and to your deployed application. Maybe adapt it with an environment variable or add the full list of all the accepted URLs.