What is the pre-flight Request | Everything about CORS explained in plain English

Cross-Origin Resource Sharing (CORS) is an HTTP header-based mechanism that allows servers to specify origins (domains, schemes, or ports) other than their own from which browsers are allowed to load resources. CORS also relies on a mechanism whereby the browser sends a "preflight" request to the server hosting the cross-origin resource to verify that the server will allow the actual request. During this preflight, the browser sends headers indicating the HTTP method and headers used in the actual request.
Cross-origin request example: Front-end JavaScript served by domain-a.com uses XMLHttpRequest to make a request to domain-b.com/data, returning json to place
For security reasons, browsers restrict cross-origin HTTP requests initiated by scripts. For example, XMLHttpRequest and Fetch API follow the same-origin policy. This means that web applications using these APIs can only request resources from the same origin the application was loaded from, unless responses from other origins contain the correct CORS headers.
CORS mechanism supports secure cross-origin requests and data transfer between browser and server. Modern browsers use her CORS in APIs like XMLHttpRequest and Fetch to reduce the risk of cross-origin HTTP requests.
Specifically, this video is aimed at his web admin, server developer, and front-end developer. Modern browsers handle the client side of cross-origin sharing, including applying headers and policies. However, the CORS standard means that the server has to handle new request and response headers.
Facebook: / krish.dinesh.official
Instagram : / krish.dinesh.official
twitter: / krishantha (@Krishantha)
#krishdinesh #cors #microservices

Пікірлер: 14

  • @samueldaniel7
    @samueldaniel7 Жыл бұрын

    Well explained, Simplicity is the ultimate sophistication - Leonardo da Vinci

  • @sajisanjoris2759
    @sajisanjoris275911 ай бұрын

    Thank you again @Krish for the subject

  • @dylanm7638
    @dylanm763811 ай бұрын

    awesome explanation sir, thank you so much

  • @loathesome_pilk_drinker
    @loathesome_pilk_drinker Жыл бұрын

    Great video!

  • @senaldolage4033
    @senaldolage4033 Жыл бұрын

    Thank you sir for this! Please do more videos like this and more videos on your series 'how software engineer thinks, rather than just a developer'

  • @OwinGunawardena
    @OwinGunawardena Жыл бұрын

    Came on youtube happily after adding enablecors to my project which I found from an article, and this is what was recommended at the top 😂

  • @krish

    @krish

    Жыл бұрын

    haa haaa ☺️

  • @shashira7220
    @shashira7220 Жыл бұрын

    Great explanation 💕

  • @amazingartsongs5298
    @amazingartsongs5298 Жыл бұрын

    Thank you so much for this. Had nightmare for weeks last year because of this. even try to contact you through FB during that time.

  • @samueldaniel7
    @samueldaniel7 Жыл бұрын

    Thank you

  • @dilieprathnayake4219
    @dilieprathnayake4219 Жыл бұрын

    superb

  • @hishamahammmedkm1936
    @hishamahammmedkm1936 Жыл бұрын

    liked

  • @rukshandevelopment2205
    @rukshandevelopment2205 Жыл бұрын

    Nice.. In my case I found that, pre-flight request is success but its gives CORS error, due to a invalid token in actual call. (Browser : Chrome). I only able to find the issue by analyzing Network calls.

  • @kalharadineth
    @kalharadineth Жыл бұрын

    wedak ati deyk demmanm hri