Solve the CORS error with Spring Security and a React frontend.

Ғылым және технология

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

Пікірлер: 22

  • @tylerdurden4563
    @tylerdurden4563Ай бұрын

    Thanks for uploading this, buddy! Awesome content

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    Ай бұрын

    You're welcome Tyler!

  • @user-qh8lt1fg8l
    @user-qh8lt1fg8l5 ай бұрын

    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

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    5 ай бұрын

    I'm so glad it helped you!

  • @user-vy9fp1ql6d
    @user-vy9fp1ql6d2 ай бұрын

    The best tutorial I found and it worked! Thank you so much and keep doing what you doing🔥💯

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    2 ай бұрын

    I'm so happy for you!

  • @muhammedbeyhanus5416
    @muhammedbeyhanus54165 ай бұрын

    Thanks a lot for clean and great tutorial.

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    5 ай бұрын

    Thanks for watching Muhammed!

  • @felipecp6958
    @felipecp6958Ай бұрын

    Ótima explicação 👏👏, ajudou muito, muito obrigado.

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    Ай бұрын

    You're welcome Felipe!

  • @vladneaga5427
    @vladneaga542717 күн бұрын

    saved my day, thank you!!!

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    13 күн бұрын

    You're welcome

  • @chrisvillegas92
    @chrisvillegas925 ай бұрын

    Thanks. Is there any difference between using this or using WebMvcConfigurer?

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    5 ай бұрын

    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.

  • @vazhabek202
    @vazhabek2024 ай бұрын

    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

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    4 ай бұрын

    I've done nothing with WebFlux. Maybe I will prepare something soon as I see many requests.

  • @vazhabek202

    @vazhabek202

    4 ай бұрын

    @@TheDevWorldbySergioLema thank you

  • @yazansadieh6991
    @yazansadieh69914 ай бұрын

    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?

  • @TheDevWorldbySergioLema

    @TheDevWorldbySergioLema

    4 ай бұрын

    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.

Келесі