Cross Origin Resource Sharing (Explained by Example)
Ғылым және технология
If you ever go a website and there some images you liked to reference in your page or blog. You would copy the link, and put in your blog. Only to find out that the image is broken? You copy the link again and paste it in URL and it opens fine?
This is an effect of CORS or Cross Origin Resource Sharing. In this video, we will discuss the main errors that you get as a result of CORS and we will fix them by Example.
Jump codes for your convenient
0:00 intro
03:00 Direct same origin access
04:00 No 'Access-Control-Allow-Origin' header is present
08:10 The ‘Access-Control-Allow-Origin' header has a different value from the origin
10:10 OPTIONS 405 Method not Allowed (Preflight failed)
17:00 Response to preflight request did not pass No 'Access-Control-Allow-Origin' header is present
19:00 Request header field “Content-Type” is not allowed
Stay Awesome!
Hussein
Пікірлер: 383
Jump codes for your convenient 03:00 Direct same origin access 04:00 CORS Policy Error #1 - No 'Access-Control-Allow-Origin' header is present 08:10 CORS Policy Error #2 - The ‘Access-Control-Allow-Origin' header has a different value from the origin 10:10 CORS Policy Error #3 - OPTIONS 405 Method not Allowed (Preflight failed) 17:00 CORS Policy Error #4 - Response to preflight request did not pass No 'Access-Control-Allow-Origin' header is present 19:00 CORS Policy Error #5 - Request header field “Content-Type” is not allowed
@aminomar7890
3 жыл бұрын
I had the same problem, searched the web, they talk too much but making it more complicated than it is ! such a people usually don not understand good, because who understand can make it easier to digest not harder! "talk too much but useless!"! you made it easy as it is ! many thanks..
@aminomar7890
3 жыл бұрын
the Web is full of those showing on but has nothing "wasting their time and others time with their nonsense!", many thanks again for for keeping it easy as it is instead of their nonsense..
@pratikgiri878
Жыл бұрын
How can I configure cors to only accept content-type : application/json ?
We need professors like you in our universities, enthusiastic and full of energy.
@glennadams7047
2 жыл бұрын
yes !!!!
@mubin986
2 жыл бұрын
absolutely!
Watching this in 2022. You had only 3215 subscribers 4 years ago. This is really an inspiration
Finally someone can explain these things clearly, thank you!
@hnasr
4 жыл бұрын
Yumeng Si really happy i could help!
This is my new favourite programming channel on KZread. Finally someone who actually knows what they're talking about, and takes time to explain what's going on from first principles.
CORS has been confusing me for so long, but after your deep dive, I actually understand what's going on when I get these errors. Thank you so much!!
Hussein you're doing an awesome job explaining concepts that no one else cares explaining. Thank you.
I was not merely informed, I was entertained. Walking through the whole process, both response and request, was very useful.
I am saving this video. Literally couldn't figure out why I couldn't access my site between using localhost and the actual ip. Thanks again!
Love the charisma, I can tell that you genuinely care about making sure we understand, great job!
@hnasr
4 жыл бұрын
Akrylic thanks 🙏 that is true I deeply care about my craft and making the best content for you guys. I also strive to get better at it so let me know how can I do better or if there is any new topic you want me to cover. Cheers Hussein
Really entertaining and basic understandable tutor I have ever see. I have read lots of documents about CORS, but that video was smashed the walls between me and CORS. Thank you very much. God bless you.
Probably the best video you can find about CORS Policy. Concise, with great examples and amazing narrative. Well done Hussein!
Oh man! I just loved the way you explained CORS! Never stop teaching and more importantly keep the same fun and energy! ❤
Very accurate, simple, no-nonsense, enjoyable explanation, thanks a lot for the efforts.
Very good explanation. Best tutorial i have ever seen. Great work.
@hnasr
5 жыл бұрын
Malkit Jatt thank you so much for watching. Glad you enjoyed the tutorial:)
@FordExplorer-rm6ew
4 жыл бұрын
@@hnasr dude, you have like every concept I ever need to know. You rock
@hnasr
4 жыл бұрын
E girl Respecter 😊 enjoy the content!
Could I solve CORS errors? Yes. Did I understand them? No. Then you came along. Thank you, Hussein! You’re awesome man, I hope you never lose your sense of excitement ✨🙏🏽💯🎊
Duuude, this was the most enjoyable tutorial I've watched in a while, great job!
@hnasr
4 жыл бұрын
Awesome! Glad you liked the video and thanks for your comment Reza!
this guy is a genius. the way you explain as a story just shows how well u understand stuff
I referred many articles on this.. but nothing could give me the clearest idea like you did right here!! Thanks for the great explanation...
WOW! This is exactly the video I was looking for. Thanks Mr. Nasser! More power to you!
My first time exploring CORS and now I understand it's rules set up by your/a server regarding what requests it allows (from whom, etc.). Thank you!
I have always been struggling with my nodejs server fixing "CORS" 😤 issues and NOW I know the errors' meaning and what cors package is actually doing behind the scenes. Thanks mate for presenting these network topics so comprehensive and fun. Your channel definitely deserves much more subs. 🚀
@hnasr
4 жыл бұрын
Shahin!! Thank you 😊 I appreciate you.
I had the same problem, searched the web, they talk too much but making it more complicated than it is ! such a people usually don not understand good, because who understand can make it easier to digest not harder! "talk too much but useless!"! you made it easy as it is ! many thanks...
Quality content ... No one can explain better than you. 👍.. creating top notch content for free deserves respect and salute 🙏
Super duper good. Explaining code by doing the same things a newbie would do with lots of missed steps or broken steps. Slowly stepping through each line of code IS the best way to teach this.
these type of explainations are what a student wants! showing the wrong thig too! Having knowledge and Teaching both are different skills. Wonder when will Universities understand that
@ashrafal
4 ай бұрын
Often University Teachers(in many countries) are Master Graduates(worse Bachelor doing part time Masters) who have not done much of real world programming. Their academic projects are in JAVA or even C++. They might be good at concept of DS & Algorithms, DB, if they are real good they might have deep understanding of Networking & OS. But, they not much understanding of webservers or web development. CORS might be something they have never come across.
thanks mate, this video is pure gold!!! I've been struggling for some days trying to fully understand this CORS stuff and now with your examples + my php experiments I'm crushing it :)
@hnasr
4 жыл бұрын
nessun00x thanks for your comment!! So happy I could help .. go crush it 💪
I’ve been reading a book about same origin policy and CORS. This video crystallizes those concepts. Thanks for the awesome content
Exactly what I have been looking for. This video should be the first in google search response. Great Job taking the pain to elaborate everything. Kudos!!
I feel like I will watch this video a lot. I tend to forget how CORS works on a regular basis. Fortunately, this video is enjoyable to watch :)
@hnasr
4 жыл бұрын
Its funny I made the video and I forget subtle differences in CORS messages as well. Thanks for your comment ❤️
unique subject i think you are the only one who explained it
I'm not a developer, but still was able to absolutely comprehend the tutorial, and that helped me to troubleshoot the application! THANK YOU!
@hnasr
3 жыл бұрын
Thanks Alex!! Glad that helped 🙏
Really amazed by your way of teaching and enthusiasm. Thanks for such neat and very understandable examples
Please Mr. Hussein, don't let this video disappear. It's an actual treasure
Thanks Hussein for the crisp and clear explanation about CORS.
great deep explanation, looked forever for a practical example of CORS, great job!!
Thank you Hussein! I was stuck on this problem for hours. I'm still learning how to build basic applications. I have a simple client application with some HTML, bootstrap, and Javascript using the XMLHttpRequest object to connect to a simple Java Spring API I have as a separate application. I kept running into this CORS problem, and as a read more and solved one issue, another issue would pop up. I knew that there was something I was missing in my understanding of CORS. Now, I have a much better understanding of what's going on with the browser and how it's handling the requests and responses 🙏
Bro, I'd donate you some money for this video 110%. You've earned a subscription out of this alone.
I have seen this error and solved this error by using third party libraries for 2 years . Today I finally understood the concept !!! Thanks a bunch for this great video!!
@hnasr
3 жыл бұрын
Excellent! thanks Fahad for your comment , glad this helps
Back when you had so little views. Now, you're one of the most notable backend developers out here on KZread. Time and consistency do wonder!
@hnasr
3 жыл бұрын
All love to you thanks!!
I was ZERO, after watching ur session, I'm feeling like HERO.. Thanks alot sir.. 🙏.
Wooow. I don't think I was gonna understand this concept elsewhere. I've subscribed too..can't wait to learn more here
This is the best video on cors that I’ve ever seen! Thank you!
Very nice explanation, this is the kind of stuff I need to really understand what is going on behind the scenes. Hussein gives really great examples in his videos. I just found out this channel and started watching videos. I have a lot to learn now!
Finally I've got the concept behind the CORS. Thanks friend!
@hnasr
3 жыл бұрын
Your welcome! Glad it helps
Best cors explanation even seen. Good Job, Hussein! Subscribed your channel without the least hesitation.
@hnasr
5 жыл бұрын
Eureka Gao thank you so much for your comment! Hope you enjoy the rest of the content in this channel! 🙏 cheers
Hey Hussein, I very very rarely make comments, so you should know this video was very helpful in my understanding of web server and client relationship especially in code because you had the simplest server and built on it. Your explanation is very GRANULAR and I love your accent haha. Keep the content coming 😅😅
Amazing video! I like how you dived deep into the coding part.
Nice video! You are the first guy that when teaching coding looks like getting high :). I know CORS what, how, but still searching examples to tell me why in security angles
I'd got lost in documentation. Thank God, I found you
Appreciate the energy you bring to the video, beats the usual dulcet tones on most!
@hnasr
4 жыл бұрын
Joodlett thanks 😊 I appreciate you noticing.. i try to lighten the mood in the videos. sometimes it works but sometimes ppl report it as distracting and I try to find the balance..
@Joodlett
4 жыл бұрын
@@hnasr works for me, I've subbed and I'll be sure to check out your channel!
You are doing a great job sir! Keep posting! Literally wondering why I discovered your channel so late.
Thanks for the practical introduction to CORS. Great video
Great content & fun to watch - good job being yourself. The bit where you were trying to pronounce "granular" was pretty funny, especially when you said "goddamit" under your breath. Keep it up!
I like your videos first then starts watching. Never regretted. 🙂
@hnasr
3 жыл бұрын
Yay! Thank you!
Very clear and full explanation man. Thank you for your work.
This video is fantastic in explanation and I cant wait to explore the rest of your videos! Keep up the great work!
@hnasr
4 жыл бұрын
Chris Rhoads thanks Chris for your comment! Enjoy the content have a great weekendd
You're so awesome, man. I do enjoy your explanation about CORS.
Thank you very much for this awesome tutorial. I finally understood it fully. Your accent is great and a pleasure to hear :)
@hnasr
4 жыл бұрын
😊🙏 thanks!!!
It helped me a lot understanding CORS, thank you Hussein
Thank you so much Hussain,you make amazing videos .Please never stop that ,its so helpful to understand at the "granular"😛 level .Loved it
Thank you very much for this extremely detailed and straight-forward explanation! 7:42 SERVED SUCCESSFULLYYYY - this one has made my day🤣
The video is awesome! Thank you Hussein.
Best video on CORS. Nice job!
Perfect explanation, example guided. Love it. Thanksss
Great material! I was frightened by those errors for a long time until now (: Thank you, Hussein!
@hnasr
4 жыл бұрын
Anton Starostin no more fear!! Its true with everything in life, everything looks scary until you clearly understand it and can articulate it
@andrescastillo2863
4 жыл бұрын
@@hnasr very nice Hussein
Great content! On OSX, if you hover on the green full screen button on the top left of a window, it allows you to split screen. Nice and easy way to prevent all the window switches.
@hnasr
4 жыл бұрын
Thanks for the tip! I ll use it for sure
Crystal clear! Love your teaching method!
@hnasr
3 жыл бұрын
Thank you 🙏
Thank you very much @hussein...i've been struggling to understand CORS concept and you really did clear that through An epic example :) Again thanks to you, I really mean it
Super video!! you made this concept really very clear to understand! :)
Great explanation and tutorial, thanks! I love your energy 😀
two years later, still a great video!
@hnasr
3 жыл бұрын
❤️❤️
Thanks a lot. Got to know soo much about cors. Also, I like your way of teaching 💯
Thanks for that Hussein. What an awesome vid. Wish I had of found this channel way before now.
@hnasr
4 жыл бұрын
Thanks Grant! Enjoy the content !
Thank you, your explanation is just wonderful. more power to you.
If you go to watch another video in the series, you might see that they are just giving the answer to the actual problem right away. That way no-one can learn. Instead after watching those videos, one might find himself looking through another reference or watching another video. But your way of making intentional mistakes and sound-changes like "zzzz" while zooming out and in are really fun. So, only if there are more tutorials like this out there to make the learning curve funner and more adventurous. Now, don't need watch another one)
Seriously great stuff Hussein!!! Stunning explanation
@hnasr
4 жыл бұрын
Thanks Andre!! Cheers and have a great day.
I don't know Python yet, but this was super helpful for understanding my CORS issue. Thanks!
Dude, I LOVE your content and your humor! Sub instantly here!
@hnasr
4 жыл бұрын
Thanks CJ for the love ❤️ glad you enjoy the content 😊
Thank goodness, someone who makes IT videos without sounding like a robot fucked a dictionary. Bless you bro. Will be back for more. Subbed!
@hnasr
4 жыл бұрын
I laughed so hard 😂 thanks bro
I love your enthusiasm!
Great video! well explained,simple to understand. Thank you Hussein.
@hnasr
4 жыл бұрын
omer Thanks Omer for your comment! Glad it was useful. Let me know what questions I can answer or what software engineering concept would you like to see next
thank you for this tutorial, it is very helpful to see these concepts of SOP and CORS in a ral simple example
Take the time to watch this video of 23 minutes, and then you won't need to waste time anymore to understand cors in the future. A well-explained detailed long video is way more valuable than 100000000000 short 2-3 minutes not well-explained videos / articles, because you're gonna watch them again again again and again and still don't get it, until the end of your life.
Thank you. Your presentation helped me a lot.
Very in depth walkthrough. Thanks!
@hnasr
4 жыл бұрын
Thanks 🙏 let me know what topic should I cover next!
Great explanation! Thank you!
Fantastic explanation, love the enthusiasm!! :D
@hnasr
4 жыл бұрын
and I love ❤️ your comment!
Nicely explained. You could go to the point more often, but it is very good presentation. Thanks!
@hnasr
4 жыл бұрын
aaa bbb thank you so much! Yeah I need to work on getting to the point quicker. Definitely will consider in next videos ..
Thank you. This was very informative and very useful.
@hnasr
5 жыл бұрын
Sean Turner thanks Sean for watching. Glad you enjoyed the content :)
Best cors video ever. Thanks sir.
Very Nicely Explained. Loved the tutorial. :) :)
@hnasr
5 жыл бұрын
Ankit Kumar thanks for watching ! Glad you enjoyed the content
Take your like my man, awesome explaining!
you sharing Hussein helps out so much, thanks
@hnasr
4 жыл бұрын
Wayne Watson thank you Wayne! Glad it helps!
Explained brilliantly!
Really Great . Clearly this explains. Thank you so much
Like the way you presented the topic even though it was a bit lengthy and had to watch it at 1.5x speed ;)
@hnasr
5 жыл бұрын
Tomek Luzak thank you so much for watching! I agree and Im working very hard to make my videos shorter and to the point. 🙏 thanks again
Thanks for making this . Very good!
habibi i love u. your tutorials are like a good movie
Super helpful & entertaining! Thanks for this!
@hnasr
4 жыл бұрын
Thanks Eddie!!