How to Run Brave Browser without CORS Restriction
A simple guide on how to start a Brave Browser instance with CORS disabled for development and testing
As a web developer, you likely need to test your REST API locally. When using a browser like Brave Browser, you might encounter issues such as the following message.
Access to fetch at ‘http://localhost:8080/api’ from origin ‘http://localhost:8000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ’no-cors’ to fetch the resource with CORS disabled.
Don’t worry, this is actually a strong security feature implemented by modern web browsers.
I won’t overwhelm you with details about CORS—you can read more in the official documentation. However, if you’re interested, here’s a summary from Wikipedia.
Cross-origin resource sharing (CORS) is a mechanism to safely bypass the Same-origin policy, that is, it allows a web page to access restricted resources from a server on a domain different than the domain that served the web page.
Here’s an example of a cross-origin request: the front-end JavaScript code served from https://example.com/ uses fetch()
to request https://example.org/api/data.json.
Luckily, bypassing CORS restrictions in Brave Browser is straightforward. Simply follow one of these guides based on your current operating system.
How to Run Brave Browser without CORS on macOS
Open your Terminal and enter the following command to launch a new instance of Brave Browser without CORS.
How to Run Brave Browser without CORS on Windows 11
Windows offers two types of command-line interpreters: PowerShell and Command Prompt (cmd.exe). Personally, I prefer using Windows Terminal on modern Windows systems, which defaults to PowerShell.
Here’s how to launch Brave Browser with CORS disabled using PowerShell.
If you’re still using the Command Prompt (cmd.exe), you can launch Brave Browser without CORS enabled using the following command.
Conclusion
That is all! You can now open a Brave Browser window with CORS disabled without affecting your main Brave Browser user data.
Thanks for reading, and see you next time!