---
title: "CORS"
sidebar_label: "CORS"
description: "How to configure CORS settings"
sidebar_position: 9
---

import Formbricks from '@theme/MDXComponents/Formbricks'
import {CustomTable} from '@selectel/docux/components'

# CORS

When a user's browser requests a bucket, it declares the domain, request method, and headers in the request. Using Cross-Origin Resource Sharing (CORS) technology, you can restrict access to objects in a bucket based on the values of these parameters.

To use CORS, the technology must be supported by both the storage and the user's browser; CORS support is enabled by default in modern browsers.

For CORS to work, [Virtual-Hosted addressing must be enabled](/s3/buckets/addressing-types.mdx#enable-virtual-hosted).

You can [configure CORS settings in the control panel](#configure-cors) or upload a configuration XML file via [S3 API](/api/object-storage-s3/).

## CORS parameters \{#parameters}

<CustomTable>
  <table>
    <thead>
      <tr>
        <th>Header</th><th>Description</th><th>Required</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <th>AllowedOrigins</th><td>List of domains from which requests to the bucket are allowed</td><td>✓</td>
      </tr>

      <tr>
        <th>AllowedHeaders</th><td>Headers available for use in a JavaScript application in the browser</td><td>✗</td>
      </tr>

      <tr>
        <th>ExposeHeaders</th><td>Headers allowed in a request to an object</td><td>✗</td>
      </tr>

      <tr>
        <th>AllowedMethods</th><td>HTTP methods allowed for use in requests. Available methods: GET, PUT, HEAD, POST, DELETE</td><td>✓</td>
      </tr>

      <tr>
        <th>MaxAgeSeconds</th><td>The time, in seconds, for which Preflight request results can be cached (in seconds). If the header is not specified, the default value of 3600 is applied</td><td>✗</td>
      </tr>
    </tbody>
  </table>
</CustomTable>

## Configure CORS \{#configure-cors}

You can add up to 100 CORS rules.

1. In the [control panel](https://my.selectel.ru/storage/), click **Products** on the top menu and select **S3**.
2. Go to the **Buckets** section.
3. Open the bucket page → **CORS** tab.
4. Click **Create Rule**.
5. Configure the [CORS rule parameters](#parameters).
6. Optional: to add another rule, click **Add Rule**.
7. Click **Create**.

<Formbricks />
