DEV Community

Luis "shadowtampa" Gomes
Luis "shadowtampa" Gomes

Posted on

CORS: Explaining with food.

CROSS-ORIGIN Resource Sharing is a policy for requesting information from a source different than yours, going against the standart same-origin policy in most of the browsers. Picture yourself having food at your home. That delicious meat that your mother cooks that is, hhhmmm, delicous, and you believe in her hands, because you know she cleans her hands, she bathes: same-origin provides you safety. But I doubt that your mom can cook a milk shake and a Big Mac in less than 5 minutes. So you order food, and unless you live inside a MCdonalds, the delivery will come from a different origin. But you know if the cooker has knowledge of ... soap? If he actually cleans his hands? Not same origin, or shorten, cross-origin is dangerous most of the times. Thats why your browser locks it up.
For further and better reading, have this link: https://web.dev/cross-origin-resource-sharing/

Top comments (0)