Set up CORS

Configure your CORS settings so that Ango Hub can safely connect to your buckets.

By default, Ango Hub cannot request resources from your cloud storage and display them in the browser due to CORS policy restrictions. To solve this, Ango Hub's domains need to be included in the CORS headers.

Here's how you can add Ango's domains to your CORS headers.

AWS S3

  1. From your AWS account, go to the S3 Management Console.

  2. Click on the bucket you'd like to connect.

  3. Go to the permissions tab.

  4. In the CORS section, click on Edit.

  5. Paste the following text in the field that pops up:

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET", "POST", "PUT", "HEAD"
        ],
        "AllowedOrigins": [
            "https://imerit.ango.ai",
            "https://imeritapi.ango.ai"
            
        ],
        "ExposeHeaders": []
    }
]

6. Click on Save changes.

For more on setting up CORS on AWS S3, check out these AWS docs.

Google Cloud Platform (GCP)

  1. Log in to the GCP console.

  2. Click on Activate Cloud Shell in the top-right corner

  3. In Cloud Shell, enter the following command:

echo '[{"origin": ["https://imerit.ango.ai","https://imeritapi.ango.ai","https://testapi.ango.ai"],"method": ["GET", "POST", "PUT", "HEAD"],"responseHeader": ["Content-Type","Access-Control-Allow-Origin"]}]' > cors-config.json

4. Apply the CORS configuration to the bucket with the following command:

gsutil cors set cors-config.json gs://<bucket-name>

5. Check the CORS configuration with the following command:

gsutil cors get gs://<bucket-name>

Microsoft Azure

From the Azure dashboard, enter Storage Accounts, then click on the storage account you'd like to change the CORS policy of. From the left-hand sidebar, click on Resource Sharing (CORS) and add two new lines to the CORS policy, like so:

Allowed OriginsAllowed MethodsAllowed HeadersExposed HeadersMax Age

https://imeritapi.ango.ai

GET,HEAD,OPTIONS

*

*

360000

https://imerit.ango.ai

GET,HEAD,OPTIONS

*

*

360000

Click on Save at the top to save your changes.

Last updated