Allow CORS: Access-Control-Allow-Origin!

sathiska sasindu
4 min readMay 29, 2024

--

Allow CORS: Access-Control-Allow-origin
  1. What is Allow CORS: Access-Control-Allow-Origin addon?
  2. What is CORS?
  3. Why use Allow CORS: Access-Control-Allow-Origin?
  4. How use Allow CORS: Access-Control-Allow-Origin?

What is Allow CORS: Access-Control-Allow-Origin addon?

This addon allows you to easily make cross-domain AJAX requests in web applications. Normally, modern browsers block cross-origin resource sharing (CORS) in JavaScript APIs. By installing this addon, you can enable this feature.

When you add the addon to your browser, it is inactive by default (the toolbar icon is a big grey “C”). To activate the addon, click the toolbar icon once. The icon will change to a big orange “C”.

What is CORS?

As mentioned above, Cross Origin Resource Sharing (CORS) is a policy that lets the browser get permission to access resources from a server on a different domain. A different domain means any domain that is not the same as the one the website is using. For example, if a page is on mySite1.com and wants to request an image from mySite2.com, this is called a CORS request. Modern browsers follow the CORS policy and block cross-origin requests if the server doesn’t allow them.

Why use Allow CORS: Access-Control-Allow-Origin?

If you are working on your project, you can face following type error.

If you use Allow CORS: Access-Control-Allow-Origin extension in web browser, you got following benefits.

  1. Development and Testing
  • During development, you might need to make cross-origin requests to servers that don’t have CORS enabled. This addon allows you to bypass CORS restrictions without modifying server settings, making it easier to test and debug your web applications.

2. Third-Party API Access

  • If you’re working with third-party APIs that do not support CORS, this addon can help you access these resources directly from your web application without running into CORS issues.

3. Quick Fix

  • For temporary situations where you need to access cross-origin resources immediately and cannot wait for server-side changes, the addon provides a quick workaround.

4. Learning and Prototyping

  • When learning about web development and experimenting with cross-origin requests, this addon can simplify the process by removing CORS-related obstacles.

However important to remember,

  1. Security Risks
  • Using this addon in a production environment can pose security risks. CORS is a security feature designed to protect users from malicious websites trying to access sensitive data. Bypassing CORS should be done cautiously and typically only in development environments.

2. Proper Configuration

  • For long-term solutions, it’s better to configure the server to handle CORS correctly, ensuring that only trusted origins are allowed to access resources.

How Use Allow CORS: Access-Control-Allow-Origin

Step 01

To download the source code for this extension from Chrome Web Store, it is recommended to use Extension Source Downloader. With this addon, you can download the source code as a ZIP or CRX format to your machine. Thus, downloading the source code from the official web stores is the best option as it always gives you the latest version of the addon.

Step 02

Then you can click the Get button to get this extension.

Step 03

Then, at the bottom left, you can see ON | OFF buttons. You can click the ON button to turn on this extension in your web browser.

After clicking the ON button, you will see the following screen.

Step 04

Using the Test CORS functionality, you can check if the extension is added correctly or not.

If you correctly added the extension, then you can see the image above when using the Test CORS functionality in the extension.

🥳 Now all are fine, and you are ready to use Allow CORS: Access-Control-Allow-Origin addon :)

Please give a clap 👏🏻 if you like this article and also if it’s useful. Thank you :)

--

--

sathiska sasindu

Full Stack Developer || Mobile Application Developer || Information Technology Undergraduate in University of Moratuwa