[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud CDN](../../index.md) > [Step-by-step guides](../index.md) > Resources > Configuring HTTP methods

# Configuring HTTP methods

To configure the allowed HTTP client requests methods for a resource:

{% note info %}

By default, the `POST`, `PUT`, `PATCH`, and `DELETE` methods are not available in client requests. To find out whether you can use these methods, contact [support](https://center.yandex.cloud/support). When contacting, describe your use case.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select the folder where your resource is located.

  1. Navigate to **Cloud CDN**.

  1. Click the resource name.

  1. Navigate to the **HTTP headers and methods** tab.

  1. In the top-right corner, click ![image](../../../_assets/console-icons/pencil.svg) **Edit**.

  1. Under **Client request methods**, select **Allowed methods** from the drop-down list.

  1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. View the description of the CLI command to update a resource:

      ```bash
      yc cdn resource update --help
      ```

  1. Get a list of all resources in the default folder:

      ```bash
      yc cdn resource list --format yaml
      ```

      Result:

      ```text
      id: s0me1dkfjq********
      folder_id: s0mef01der7p********
      cname: testexample.com
      created_at: "2022-01-19T09:23:57.921365Z"
      updated_at: "2022-01-19T10:55:30.305141Z"
      active: true
      options:
        edge_cache_settings:
          enabled: true
          default value: "345600"
        cache_http_headers:
          enabled: true
          value:
          - content-type
          - content-length
          - connection
          - server
          - date
          - test
        stale:
          enabled: true
          value:
          - error
          - updating
        allowed_http_methods:
          value:
          - GET
          - HEAD
          - OPTIONS
      origin_group_id: "89783"
      origin_group_name: My origins group
      origin_protocol: HTTP
      ssl_certificate:
        type: DONT_USE
        status: READY
      ```

  1. Specify the allowed HTTP methods for client requests using the `--allowed-http-methods` parameter:

      ```bash
      yc cdn resource update <resource_ID> \
        --allowed-http-methods <allowed_methods>
      ```

      For more information about the `yc cdn resource update` command, see the [CLI reference](../../../cli/cli-ref/cdn/cli-ref/resource/update.md).

- Terraform {#tf}

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  1. In the configuration file, describe the properties of the CDN resource to create:

      ```hcl
      resource "yandex_cdn_resource" "my_resource" {
        cname               = "cdn1.yandex-example.ru"
        active              = false
        origin_protocol     = "https"
        secondary_hostnames = ["cdn-example-1.yandex.ru", "cdn-example-2.yandex.ru"]
        origin_group_id     = yandex_cdn_origin_group.my_group.id
        options {
          allowed_http_methods = ["GET","HEAD","OPTIONS"]
        }
      }
      ```

      Where:

      * `cname`: Primary domain name used for content distribution. This is a required setting.
      * `active`: Flag indicating content availability to end users. `True`: CDN content will be available to clients. This is an optional setting. The default value is `true`.
      * `origin_protocol`: Protocol for origins. This is an optional setting. The default value is `http`.
      * `secondary_hostnames`: Additional domain names. This is an optional setting.
      * `origin_group_id`: [Origin group](../../concepts/origins.md) ID. This is a required setting. Use the ID from the description of the origin group in the `yandex_cdn_origin_group` resource.
      * The `options` section contains additional parameters of CDN resources:
         * `allowed_http_methods`: HTTP methods allowed for your CDN content. By default, the following methods are allowed: `GET`, `HEAD`, and `OPTIONS`. If the user is not allowed to use any method, they will get the `405` _Method Not Allowed_ response. For methods that are not supported, the user will get `501` (_Not Implemented_).

      For more on the properties of `yandex_cdn_resource` in Terraform, see [this provider guide](../../../terraform/resources/cdn_resource.md).

  1. In the command line, navigate to the directory with the Terraform configuration file.

  1. Check the configuration using this command:
     ```
     terraform validate
     ```

     If the configuration is valid, you will get this message:

     ```
     Success! The configuration is valid.
     ```

  1. Run this command:
     ```
     terraform plan
     ```

     You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.

  1. Apply the configuration changes:
     ```
     terraform apply
     ```

  1. Type `yes` and press **Enter** to confirm the changes.

     You can check the CDN resource update in the [management console](https://console.yandex.cloud) or using this [CLI](../../../cli/quickstart.md) command:

     ```
     yc cdn resource list
     ```

- API {#api}

  Use the [update](../../api-ref/Resource/update.md) REST API method for the [Resource](../../api-ref/Resource/index.md) resource or the [ResourceService/Update](../../api-ref/grpc/Resource/update.md) gRPC API call.

{% endlist %}

It may take up to 15 minutes for the new settings of the existing resource to apply to the CDN servers. After that, we recommend [purging the resource cache](purge-cache.md).

## Examples {#examples}

{% list tabs group=instructions %}

- CLI {#cli}

  Add the allowed GET method to the resource:

    ```bash
    yc cdn resource update s0me1dkfjq******** --allowed-http-methods GET
    ```
  
  Result:

    ```text
    id: s0me1dkfjq********

    ...

    cname: testexample.com
    active: true

    ...

    allowed_http_methods:
    enabled: true
    value:
    - GET
    ```

{% endlist %}

#### Useful links {#see-also}

* [Configuring data exchange between clients and the CDN](../../concepts/clients-to-servers.md)