Published on

Configuring CORS for your site

Authors is by far the simplest way to deploy a static site.

There is no CI/CD pipeline, no git, no time-consuming build process, Nothing.

You just upload the files and it just renders them.

You only have a CLI to interact with it and it takes care of the rest.


The only dependency that you've is installing their CLI. Make sure you've Node.js installed on your machine.

Then, you can install Surge by running the following command:

npm install --global surge

And once it's installed login/create your account by entering the username and password.

Configuring CORS for your site

Just go to the directory which you want to publish/host (usually, dist)

And then create a file called CORS in the directory that you want to publish and configure it based on your needs.

If you want to allow all the hosts then just add * in that file.

You can run the following command to create a file with * in it as well.

echo '*' > CORS

And publish it:

surge --domain

That's pretty much it. Now any host can access your resources.

Adding CORS for specific domains

If you prefer adding CORS for specific domains/hosts only then you can just add the domain names in the CORS file instead of *

And for multiple hosts, just add multiple domains in the CORS file

Happy sharing resources!