CORS, Preflight Request, OPTIONS Method | Access Control Allow Origin Error Explained

Поділитися
Вставка
  • Опубліковано 3 гру 2024

КОМЕНТАРІ • 224

  • @vikramkrish710
    @vikramkrish710 5 років тому +226

    Hi Akshay, I learned a lot from this video. However I have a small correction to point out. At 06:50 you have written it as `accept-control-allow-origin: * ` while it is `access-control-allow-origin: *`. Extremely sorry for pointing out but some other beginner may capture it wrongly. Kindly put a patch message on screen while that portion is playing.

    • @HarshSingh-hk8fe
      @HarshSingh-hk8fe 3 роки тому +2

      @@shankarnarayanb thanks alot for bro

    • @nabhoyar
      @nabhoyar 3 роки тому +3

      Thanks Vikram for pointing out. It really helped to make out the difference

    • @pemadechen9199
      @pemadechen9199 Рік тому +3

      Wow it took me like more than a minute to find the difference between the two section. Certainly would have taken me a lot of time finding the solution.
      Thank you

  • @garudkardnyaneshwar3426
    @garudkardnyaneshwar3426 4 роки тому +2

    Bhai tune jo bataya na jis way m, jaise explain kiya man gaya teko aajtk smjhi nahi thi ye concept etni achese thank you man

  • @primetech505
    @primetech505 Рік тому +2

    "Thank you, my friend, for providing such a straightforward and simplified explanation of how CORS works. Your explanation has helped me understand this topic better. Great job!"

  • @haverikakrishna
    @haverikakrishna Рік тому +6

    This is the reason why every developer is the fan and in love with you, you teach the things in the way they are to be delivered to the consumers/audience..
    I want to mention this to, before whenever I used to watch content of any other youtuber it was quite obvious that I yawned for 2-3 times, but here whenever I watch your videos I never do that (or it wont come also), instead at this time I was very sleepy, but before going to sleep I just want to clear out this topic and now here I'm ready to move to you another video with full energy.
    Thanks bhaiya for making such a wonderful content..😍😍

  • @thatsalot3577
    @thatsalot3577 2 роки тому +1

    ok this is the first time someone actually explained what CORS is instead of just giving 10 different ways to get rid of the error, just a header ! lol

  • @ayushbhardwaj6783
    @ayushbhardwaj6783 3 роки тому +7

    No other video could explain CORS soo briefly and easily. Thankyou Akshay♥️♥️

  • @thesudeshdas
    @thesudeshdas 8 місяців тому

    Finally, I understand how CORS works. This was awesome. Got to learn a lot.

  • @viralpasad9022
    @viralpasad9022 5 років тому +8

    Your series is nothing but AMAZING!

  • @abhishekvishwakarma9045
    @abhishekvishwakarma9045 3 роки тому +14

    Recently (two days back😁) I had my Full-stack Interview and they asked me about the middlewares😅 (Which I explained Using the example of Cors :) but that time I have only a little knowledge about cors (The interview went well but this question really scratch my head) And now after this, I can explain cors easily thanks to you sir😁🔥

  • @rank3937
    @rank3937 Рік тому

    Apart from detailed content, I admire your effort for including commonly asked interview questions.

  • @saurabhkacholiya
    @saurabhkacholiya 4 роки тому +3

    Thanks a lot. I have learned a lot form your videos explanation today I am having a big interview coming up today thanks a lot for the video again

    • @akshaymarch7
      @akshaymarch7  4 роки тому +1

      All the very best @Saurabh. May be code be with you! 👍🏾

  • @subhajit99motivation
    @subhajit99motivation Рік тому +1

    Thanks a lot Akshay, I was stuck at my project due to this, and your video resolved the issue. Doing great work bro. 😇

  • @rohitkudalkar92
    @rohitkudalkar92 4 роки тому +11

    Thank you so much sir. I was searching for the same in few months back, Today randomaly i watched your video and get to know that why my react app was not able to fetch data from API when i run it on another server like 3001. Thanks you so much sir for sharing your Efforts and knowledge. Love ❤️ and Support.

    • @tarunkumar.d8379
      @tarunkumar.d8379 3 роки тому

      isn't fetch or axios. get is not enough to fetch data from api??

  • @AbdulQadir-eb1vi
    @AbdulQadir-eb1vi 3 роки тому +4

    Amazing work. I like the idea of explaining to whiteboard, really helped me understand the logic behind cors, this is what great teachers do.

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

    Impressive, you won our hearts. Straight to the point

  • @kushalbhargava8212
    @kushalbhargava8212 11 місяців тому

    Now i completely understood what cors is
    Thank you

  • @HarshSingh-hk8fe
    @HarshSingh-hk8fe 3 роки тому +2

    the way you explain cors is outstanding really loved it

  • @shivankgoyal7737
    @shivankgoyal7737 2 роки тому

    This is what I was looking for!! Excellent video.

  • @vasilvasilev6225
    @vasilvasilev6225 2 роки тому

    Very explicit and right to the point explanation!

  • @ycombinator765
    @ycombinator765 2 роки тому

    only a legend can explain legendary concepts

  • @yashgupta-dw7sn
    @yashgupta-dw7sn 3 роки тому

    Best explanation in the market

  • @shraddhasonawane1491
    @shraddhasonawane1491 4 роки тому

    Thanks @Akshay this video is so useful for not only a developer but Pentester like us.

  • @nabhoyar
    @nabhoyar 3 роки тому

    Thanks Akshay for sharing beautiful explanation about CORS. Its really most frequently asked questions in interview.

  • @emilandrzejewski7518
    @emilandrzejewski7518 Рік тому

    Nice video showing what is going on under the hood. Personally, there was no live example showed in code, browser etc

  • @seifeslimene
    @seifeslimene 3 роки тому +3

    Great explanation but there was a mistake in the video.
    the response header is access-control-allow-origin and not accept-control-allow-origin.

  • @meenakshigupta6889
    @meenakshigupta6889 5 років тому

    Please make a video on web workers and service workers. I find it hard to understand. Your videos are very informative..Thanks a lot for sharing them.

  • @disha9876
    @disha9876 2 роки тому

    So cool! , I'd love it if some images could pop as you speak to explain, than plain talking, it'll look interactive

  • @mohideenabdulkadhar4280
    @mohideenabdulkadhar4280 2 роки тому

    good explanation about CORS. it is very useful

  • @vinothkumarv9722
    @vinothkumarv9722 4 роки тому

    Wow awesome bro clear explanation love you !.....
    The image which you shared API request to data response from server is super....

  • @debadipti
    @debadipti 5 років тому +2

    Just about time Akshay! I have an interview tomorrow ... Hope it will help :) Thanks

  • @nicetomeetugaming7024
    @nicetomeetugaming7024 2 роки тому

    Amazing video sir, very easy to understand.

  • @vitalvisions4U
    @vitalvisions4U 3 роки тому

    Hmm, got it. However, was expecting more details with example, like other videos in the interview series.

  • @programmingfitness6211
    @programmingfitness6211 4 роки тому

    Hi Akshay ur way of explaining is 🔥, If u reading this then pls make a video on closure beleive me you will get blessings of many developers like me

  • @Siddharth-uo6zw
    @Siddharth-uo6zw Рік тому +1

    came here while learning namaste React🙏

  • @shikhakumari9241
    @shikhakumari9241 5 років тому +7

    Hey Akshay, thanks a lot for uploading such informative videos. Could you please upload tutorials on JS Engine and how Web APIs, Callback Queues, Event loop works together with JS Engine to run JS on browser

  • @paragchoudhary509
    @paragchoudhary509 2 роки тому

    Special thanks for this video 🤟💯💯

  • @animeshsharma8285
    @animeshsharma8285 5 років тому +3

    Hi Akshay, thanks for your extremely helpful videos. Would request you to please help to understand the concept of microservices and how a JavaScript based app fits into this

  • @fanatic12345
    @fanatic12345 3 місяці тому

    Very nicely explained bro

  • @ShivumJashnani
    @ShivumJashnani 3 роки тому

    Beautiful video. Great job! Easy to understand.

  • @neeve-gg7kz
    @neeve-gg7kz 5 місяців тому

    Thank you for the wonderful knowledge.
    How to resolve the cors error

  • @mohankadolkar1227
    @mohankadolkar1227 4 роки тому

    Excellent. Understood the concept. Thanks.

  • @krushnajawane2097
    @krushnajawane2097 4 роки тому

    Really nice tutorial for CORS ...

  • @PatelNikhil
    @PatelNikhil 3 роки тому

    It would be helpfull if you can practically demonstrated this concept like your other videos you always start with your screen sharing. Please can you make other video with ref to this by showing on same localhsot with diff ports communicating with and without CORS compliances of header supported , it would be grate help to all of us if you can do this.

  • @omprakashsharma281
    @omprakashsharma281 3 роки тому

    Hi Akshay,
    as always, i learn something new from your video. Please create video on micro services as well
    Thanks

  • @amjadsaleem1270
    @amjadsaleem1270 3 роки тому

    Thumbs up for the example pic at 1:23

  • @sameergaikwad222
    @sameergaikwad222 4 роки тому

    Thanks Akshay :) This really helped in my understanding of CORS concept and resolving most request calls issue while developing projects :)

  • @auroshisray9140
    @auroshisray9140 2 роки тому

    Thanks a lot! Great video bhaiya

  • @nitishrana848
    @nitishrana848 3 роки тому +1

    Thanks man....this helped me a lot.

  • @shloch2007
    @shloch2007 4 роки тому +2

    thanks for this video...i learned alot

  • @abhishekpradhan7824
    @abhishekpradhan7824 2 роки тому

    Somehow he managed to clear the interview ,that doesn't mean anyone can clear the interview by following these videos

  • @laxman7620
    @laxman7620 4 роки тому +1

    Hey Akshay, Can you create Micro frontend learning video , it would be great to all developer for learning and also this concepts running in current market. Thanks in Advance

  • @mdsujan6686
    @mdsujan6686 3 роки тому

    What a gem!
    Thank you sir.

  • @sohamkamanitech
    @sohamkamanitech 5 років тому +1

    These are a great set of videos! Keep up the good work :)

  • @mayhemant
    @mayhemant 4 роки тому +2

    In beginning about 2 months ago I thought your videos are not of work!
    And 2 months later, here is me finding these very important and I have already seen most of your upload😂😂;
    Thank you Saini sir ❤️🦄🦄🦄🦄;

  • @neerajnegi5391
    @neerajnegi5391 4 роки тому

    Nice explanation one query How browser decide to make a pre-flight request what are these steps?

  • @ehabahmedyassen
    @ehabahmedyassen Рік тому

    10:35 I have just learned about CORS recently and I have a question about by-passing CORS security mechanism. As I understand; the CORS configurations are made at the server side to handle cross origin resources access/sharing. So, does it even make sense to have a browser plugin or to start the browser with specific flags to by-pass CORS?

    • @harshitakohli9308
      @harshitakohli9308 Рік тому

      Yes even I have the same doubt... If we start our browser with '--disable-web-security ' flag, the browser does not send the preflight request and neither does it validate CORS headers, then how does the server still send back response to the browser?

  • @vivekbisht6815
    @vivekbisht6815 3 роки тому

    Please make series on microservices nowdays it is very popular not a good content avilable at youtube except you

  • @akshatbhatt4022
    @akshatbhatt4022 5 років тому

    Your material is awesome maan.

  • @mohitdiwakar9558
    @mohitdiwakar9558 3 роки тому

    Very nice explained

  • @rahulkumbhar4446
    @rahulkumbhar4446 3 роки тому

    Thank you Akshay...this is really helpful 👍

  • @shaktisinhjhala5758
    @shaktisinhjhala5758 3 роки тому

    Perfect Video! thanks a lot for such a nice and detailed explanation about CORS :)

  • @YogaJourneyWithSukhjitKaur
    @YogaJourneyWithSukhjitKaur 4 роки тому

    Very useul resource ! Thank you

  • @starry589
    @starry589 10 місяців тому

    Thanks! Forever thankful!

  • @nityadeepika1967
    @nityadeepika1967 3 роки тому

    Thankyou so much for this video

  • @akshay1363
    @akshay1363 4 роки тому

    hi ,your explanation is good and you mentioned something like CORS is not error and we make some mistake some thing kind of thing. can you explain more on that, what is mistake from our end if CROS policy not enabled at server end in which we don't have any control over it(i.e Third party API).
    2) If don't have access or control over server side to make changes, how to Handel this error at client side??

  • @abhiagarwal281295
    @abhiagarwal281295 4 роки тому

    Good video, but the technical details were not conveyed properly. But yes, it does set up some pretext post which one definitely has to go through some online documents.

  • @saikiran4721
    @saikiran4721 5 років тому +1

    please do more videos on js. Thanks

  • @YogeshSatale
    @YogeshSatale 4 роки тому

    Hi akshay, excellent teaching. Lots of thanks but i have a question. 1.When we direct api url hit in browser url adress then how it works? 2.when we call using fetch then how it will work?

  • @uimonk
    @uimonk 11 місяців тому

    awesome yaar... well explained!!

  • @rishabgupta3419
    @rishabgupta3419 10 місяців тому

    Nice explaination

  • @surbhirathi5753
    @surbhirathi5753 4 роки тому

    hi Akshay, very well explained, but could you pl suggest what we can handle OPTIONS method timedout case just before POST? Thank you in advance!

  • @abilashsethumadhav2452
    @abilashsethumadhav2452 4 роки тому

    Great explanation

  • @ninjaduck3534
    @ninjaduck3534 3 роки тому

    @8:53 "So the answer is no"
    BLEEEP

  • @sumeetjain1894
    @sumeetjain1894 2 роки тому

    Hi Akshay, I really liked the video. There's a correction in the video where you've shown the example of preflight request require before the POST request. But POST is listed as a method that doesn't require preflights in CORS. It's DELETE, HEAD, PUT which generally requires preflight request.

    • @AnnaWD
      @AnnaWD 2 роки тому +1

      It requires if data has some type that is not application/x-www-form-urlencoded || multipart/form-data || text/plain

  • @indiabest1744
    @indiabest1744 4 роки тому

    Akshay bro can u pls create a series such that we can follow in sequence from beginner to advanced js and in bw those vedio interview q discussed as per that topic. Many people wanna learn core js from u and in sequence bro step by step . Automatic you will cover topic as asked intrvw

  • @SajidAliSoftwareEngineer
    @SajidAliSoftwareEngineer 3 роки тому

    awesome brother really nicely you explain.

  • @user-mi8ew2to8e
    @user-mi8ew2to8e 4 роки тому +1

    Akshay Saini's voice is very similar to Akshay Kumar

  • @Su_Has
    @Su_Has 3 роки тому +1

    Aren't front end and back end of a web application hosted on different domains? How does that not cause CORS issue?

  • @poonamw26
    @poonamw26 Рік тому

    Coming here after 1st Namaste React webseries 🤩

  • @md-ayaz
    @md-ayaz 4 роки тому +1

    The video is on point.

  • @swarnendustudy1792
    @swarnendustudy1792 3 роки тому

    very helpful video

  • @gagangupta1255
    @gagangupta1255 4 роки тому

    Awesome video Akshay !! you rock

  • @rashmisharma7388
    @rashmisharma7388 5 років тому +2

    Options request is still showing in firefox , even if it has removed from Access-Control-Allow-methods

  • @Quantnom
    @Quantnom Рік тому

    I am having an issue with my django and react app sending options request but then not being able to send the post... it succesfully sends the OPTIONS with 200 code, then the post + Preflight doesnt work....

  • @_hulk748
    @_hulk748 6 місяців тому

    Great Video Sir

  • @vortexdeo4545
    @vortexdeo4545 Рік тому

    I watched some MERN app tutorials using cors() middleware on express server side to allow reaact app to hit express api routes, Is that bypassing and compromising the security somehow? Because server side doesnot have app any specific port info(for local development) as to which origin to allow and which not 🤔

  • @punnapranay9089
    @punnapranay9089 3 роки тому

    Thanks for the session, it was helpful. Can you make a session on csrf token. It would be helpful.

  • @j4jainam
    @j4jainam 2 роки тому

    Nice Demo,
    But In my case I am only allowed to permit specific Origins so I can use the way of "Multiple origins"
    but my "Multiple origins" are not in my hand.. it is coming from a database table.. so How Can I use it ???

  • @hossamawad4880
    @hossamawad4880 2 роки тому

    great work👏

  • @krishnanigalye1173
    @krishnanigalye1173 4 роки тому

    I didn't get the part where you said preflight calls are made to check if the request is valid/safe. I mean in what sense it should be safe/valid?

  • @vidhya821
    @vidhya821 3 роки тому

    Thanks for the video Akshay! But can you have the light source directed at the white board and not at the top? its difficult to see the content written with the overhead lights.

  • @jyoti1221
    @jyoti1221 3 роки тому

    Hello sir , we using cors so that if anyone hit the api .he should be authorised first. So i wanted to uses headers of this cors request becoz in our case login and api hitting functionality is different? Please reply soon 😩😩

  • @DrunkenEngineer
    @DrunkenEngineer 4 роки тому

    Thanks for sharing.

  • @jenks2897
    @jenks2897 2 роки тому

    What if I don't what to access or change any data just want to click a button on website A which then clicks or simulate a click on website B and execute a function, does this falls under CORS ?
    If not any suggestion on how this can be done?

  • @punjabiprincesscode1626
    @punjabiprincesscode1626 2 роки тому

    I love the expression in your eyes :x

  • @vasanthram2776
    @vasanthram2776 2 роки тому

    thanks for this video

  • @ruchinbaliyan9785
    @ruchinbaliyan9785 3 роки тому

    Thank you for the details, But I am getting {has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.} this cors error , Any idea about this ?

  • @abudkamil3319
    @abudkamil3319 5 років тому +1

    Please tell me some good resources (books, course, tutorial) to get in and out of vanilla JavaScript like your way of learning JavaScript.
    Thanks

    • @suman6327
      @suman6327 5 років тому +1

      Just read The JavaScript Ninja by John Resig(jQuery creator)

    • @akshaymarch7
      @akshaymarch7  5 років тому +2

      I like, YDKJS. But you can go with any resource you want to, just make sure you practice things after reading. That's the key ;)

    • @abudkamil3319
      @abudkamil3319 5 років тому

      @@akshaymarch7 practice how? Please explain.Sorry if borthering you much

    • @akshaymarch7
      @akshaymarch7  5 років тому

      Try to use any concept you learn in some project. Or at least try to write the code yourself once and tweak few things and explore how it works. Also read about the scenarios where that can be helpful.

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

    I am a junior frontend developer. I have an issue with the cors as u mentioned in the last part of the video . They asked me to resolve it by having a chrome extension called CORS UNBLOCK , But then again i can't able to bypass the error .
    So my question is there any possibility that the error will not be resolved after having the extention?

  • @abhijeetgupta3461
    @abhijeetgupta3461 Рік тому

    Can you please tell us what is the criteria on which the server validates the preflight call, I mean how the server decides whether to allow a request