> For the complete documentation index, see [llms.txt](https://docs.imerit.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imerit.net/data/storages/set-up-cors.md).

# Set up CORS

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:

{% tabs %}
{% tab title="EU Instance (Default)" %}

```json
[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET", "POST", "PUT", "HEAD"
        ],
        "AllowedOrigins": [
            "https://imerit.ango.ai",
            "https://imeritapi.ango.ai",
            "https://tools.ango-pct.imerit-prod.io"
        ],
        "ExposeHeaders": []
    }
]
```

{% endtab %}

{% tab title="US Instance" %}

```json
[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET", "POST", "PUT", "HEAD"
        ],
        "AllowedOrigins": [
            "https://us.ango.ai",
            "https://us-api.ango.ai"
        ],
        "ExposeHeaders": []
    }
]
```

{% endtab %}

{% tab title="India Instance" %}

```json
[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET", "POST", "PUT", "HEAD"
        ],
        "AllowedOrigins": [
            "https://in.ango.ai",
            "https://in-api.ango.ai"
        ],
        "ExposeHeaders": []
    }
]
```

{% endtab %}

{% tab title="Test Instance" %}

```json
[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET", "POST", "PUT", "HEAD"
        ],
        "AllowedOrigins": [
            "https://test.ango.ai",
            "https://testapi.ango.ai"
        ],
        "ExposeHeaders": []
    }
]
```

{% endtab %}
{% endtabs %}

6\. Click on Save changes.

For more on setting up CORS on AWS S3, check out these [AWS docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html).

## 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 (remove the URLs mentioning "test" if you do not plan on using our testing platform):

{% tabs %}
{% tab title="EU Instance (Default)" %}

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

{% endtab %}

{% tab title="US Instance" %}

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

{% endtab %}

{% tab title="India Instance" %}

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

{% endtab %}

{% tab title="Test Instance" %}

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

{% endtab %}
{% endtabs %}

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

```bash
gsutil cors set cors-config.json gs://your-bucket-name
```

5\. Check the CORS configuration with the following command:

```bash
gsutil cors get gs://your-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 Blob service CORS policy, like so:

{% tabs fullWidth="false" %}
{% tab title="EU Instance (Default)" %}

<table data-full-width="false"><thead><tr><th width="212.984375">Allowed Origins</th><th width="184.32421875">Allowed Methods</th><th width="104.4609375">Allowed Headers</th><th width="106.1484375">Exposed Headers</th><th>Max Age</th></tr></thead><tbody><tr><td>https://imeritapi.ango.ai</td><td>GET,PUT,HEAD,OPTIONS</td><td>*</td><td>*</td><td>360000</td></tr><tr><td>https://imerit.ango.ai</td><td>GET,PUT,HEAD,OPTIONS</td><td>*</td><td>*</td><td>360000</td></tr></tbody></table>
{% endtab %}

{% tab title="US Instance" %}

<table data-full-width="false"><thead><tr><th width="212.984375">Allowed Origins</th><th width="184.32421875">Allowed Methods</th><th width="104.4609375">Allowed Headers</th><th width="106.1484375">Exposed Headers</th><th>Max Age</th></tr></thead><tbody><tr><td>https://us-api.ango.ai</td><td>GET,PUT,HEAD,OPTIONS</td><td>*</td><td>*</td><td>360000</td></tr><tr><td>https://us.ango.ai</td><td>GET,PUT,HEAD,OPTIONS</td><td>*</td><td>*</td><td>360000</td></tr></tbody></table>
{% endtab %}

{% tab title="India Instance" %}

<table data-full-width="false"><thead><tr><th width="212.984375">Allowed Origins</th><th width="184.32421875">Allowed Methods</th><th width="104.4609375">Allowed Headers</th><th width="106.1484375">Exposed Headers</th><th>Max Age</th></tr></thead><tbody><tr><td>https://in-api.ango.ai</td><td>GET,PUT,HEAD,OPTIONS</td><td>*</td><td>*</td><td>360000</td></tr><tr><td>https://in.ango.ai</td><td>GET,PUT,HEAD,OPTIONS</td><td>*</td><td>*</td><td>360000</td></tr></tbody></table>
{% endtab %}

{% tab title="Test Instance" %}

<table data-full-width="false"><thead><tr><th width="212.984375">Allowed Origins</th><th width="184.32421875">Allowed Methods</th><th width="104.4609375">Allowed Headers</th><th width="106.1484375">Exposed Headers</th><th>Max Age</th></tr></thead><tbody><tr><td>https://testapi.ango.ai</td><td>GET,PUT,HEAD,OPTIONS</td><td>*</td><td>*</td><td>360000</td></tr><tr><td>https://test.ango.ai</td><td>GET,PUT,HEAD,OPTIONS</td><td>*</td><td>*</td><td>360000</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

Click on *Save* at the top to save your changes.

Azure uploads from Ango Hub use temporary SAS URLs and the `x-ms-blob-type: BlockBlob` header. Keeping `Allowed Headers` set to `*` covers this header.
