---
title: "Discussion on \"Web Security: Cross-Origin Resource Sharing (CORS)\" | Hashnode"
description: "Discussion on \"Web Security: Cross-Origin Resource Sharing (CORS)\". It’s every developer’s frustration once in a while to see that big red Access to fetched has been blocked by CORS policy error in your console! 😁\nAlthough there are some ways to quickly get rid of this error, let’s not take anything for granted toda..."
url: "https://hashnode.com/posts/web-security-cross-origin-resource-sharing-cors/60966d8221068818a5c6108a"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Web Security: Cross-Origin Resource Sharing (CORS)](https://blog.learncodeonline.in/web-security-cross-origin-resource-sharing-cors?utm_source=hashnode&utm_medium=feed)

It’s every developer’s frustration once in a while to see that big red Access to fetched has been blocked by CORS policy error in your console! 😁 Although there are some ways to quickly get rid of this error, let’s not take anything for granted toda...

Feb 1, 2022 · 9 min read · blog.learncodeonline.in  
Updated Feb 26, 2022  
Read the article

-   [#cors](https://hashnode.com/tag/cors)
-   [#security](https://hashnode.com/tag/security)
-   [#web](https://hashnode.com/tag/web)
-   [#http](https://hashnode.com/tag/http)
-   [#https](https://hashnode.com/tag/https)

## Written by

[Sumanth S](https://hashnode.com/@SumanthS)

@SumanthS · Bangalore

  
[View profile](https://hashnode.com/@SumanthS)

Think beyond the world, but design and develop the existing world 👨‍💻

I am passionate about the latest tech and coding. Take a look at my amazing, world-class blog content on Test Automation(Selenium, Cypress and Playwright), API-Automation, JavaScript, Python, Svelte, VueJs, ReactJS, Angular, Flutter, and more...

## Responses 3

Markdown supported · ⌘↵ to post

[Denish Ranpariya](https://hashnode.com/@thisisdenish)

[Oct 2, 2022](https://hashnode.com/posts/web-security-cross-origin-resource-sharing-cors/60966d8221068818a5c6108a/comment/63397bc3fa20fa4bc8e586c3)

Very nice blog [Sumanth S](https://hashnode.com/@SumanthS), Loved the way you explained it in simple manner and using some images. Thanks.

[Ayush Choudhary](https://hashnode.com/@ayush457)

[May 17, 2021](https://hashnode.com/posts/web-security-cross-origin-resource-sharing-cors/60966d8221068818a5c6108a/comment/60a2509123723215ec2ff2fb)

Great Article...Loved the explanation...👍👍

[Sumanth S](https://hashnode.com/@SumanthS)

[May 19, 2021](https://hashnode.com/posts/web-security-cross-origin-resource-sharing-cors/60966d8221068818a5c6108a/comment/60a2509123723215ec2ff2fb#reply-60a4881c59b7dc409c3d2796)

Thanks [Ayush Choudhary](https://hashnode.com/@ayush457)

[Dheeraj Mahra](https://hashnode.com/@dheerajmahra)

[May 10, 2021](https://hashnode.com/posts/web-security-cross-origin-resource-sharing-cors/60966d8221068818a5c6108a/comment/6098c2c61ea29f2c341e2089)

I faced one issue related to cors some days back. When hitting an api with axios, I was getting <No Access-Control-Allow-Origin> header present on the server but I was able to make a successful call when hitting it with anchor tag. Any idea why??

[Sumanth S](https://hashnode.com/@SumanthS)

[May 10, 2021](https://hashnode.com/posts/web-security-cross-origin-resource-sharing-cors/60966d8221068818a5c6108a/comment/6098c2c61ea29f2c341e2089#reply-6098e8ed21068818a5c63a7c)

Update: Access-Control-Allow-Origin is a response header - so in order to enable CORS - you need to add this header to the response from your server.

headers: {"Access-Control-Allow-Origin": "\*"}

kindly add the above line, check it once

[Dheeraj Mahra](https://hashnode.com/@dheerajmahra)

[May 10, 2021](https://hashnode.com/posts/web-security-cross-origin-resource-sharing-cors/60966d8221068818a5c6108a/comment/6098c2c61ea29f2c341e2089#reply-6098ea0f21068818a5c63a89)

[Sumanth S](https://hashnode.com/@SumanthS) Yes I know tthe point that this header is required to enable CORS. But, It is a third party api and they have not added this header I guess. But how am I able to access it with anchor tag then??
