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
  • Наука та технологія

КОМЕНТАРІ • 22

  • @tylerdurden4563
    @tylerdurden4563 Місяць тому +1

    Thanks for uploading this, buddy! Awesome content

  • @user-qh8lt1fg8l
    @user-qh8lt1fg8l 5 місяців тому

    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

  • @user-vy9fp1ql6d
    @user-vy9fp1ql6d 2 місяці тому

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

  • @muhammedbeyhanus5416
    @muhammedbeyhanus5416 5 місяців тому

    Thanks a lot for clean and great tutorial.

  • @felipecp6958
    @felipecp6958 Місяць тому

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

  • @vladneaga5427
    @vladneaga5427 17 днів тому

    saved my day, thank you!!!

  • @chrisvillegas92
    @chrisvillegas92 5 місяців тому

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

    • @TheDevWorldbySergioLema
      @TheDevWorldbySergioLema  5 місяців тому +1

      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
    @vazhabek202 4 місяці тому

    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 місяці тому +1

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

    • @vazhabek202
      @vazhabek202 4 місяці тому

      @@TheDevWorldbySergioLema thank you

  • @yazansadieh6991
    @yazansadieh6991 4 місяці тому

    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.