Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Cloud CDN
  • Getting started
    • All guides
      • Creating a resource
      • Copying configuration from one resource to another
      • Updating basic settings of a resource
      • Getting information about a resource
      • Configuring resource caching
      • Configuring log export
      • Prefetching files to CDN servers
      • Purging resource cache
      • Configuring request and response headers
      • Configuring CORS for responses to clients
      • Configuring HTTP methods
      • Enabling file compression
      • Enabling file segmentation
      • Enabling origin shielding
      • Setting up a request redirect
      • Enabling a resource to follow request redirects
      • Set up hiding of origin headers
      • Setting up access via a secure token
      • Setting up location rules
      • Disabling a resource
      • Managing resource labels
      • Deleting a resource
      • Viewing resource statistics
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Request logs
  • Audit Trails events
  • Release notes
  • Troubleshooting
  1. Step-by-step guides
  2. Resources
  3. Set up hiding of origin headers

Setting up hiding of origin headers

Written by
Yandex Cloud
Updated at February 26, 2026

You can set up hiding of origin headers using the API when creating or updating a CDN resource.

Warning

Hiding important headers may be disruptive for your web application.

REST API
gRPC API

To enable the option, add the headerFilter section when using the create or update method for a Resource:

"headerFilter": {
  "enabled": "<true_or_false>",
  "headers": [
    "<list_of_headers>"
  ]
}

Where:

  • enabled: Enabling the option:

    • true enables the option.
    • false disables the option.
  • headers: List of HTTP headers the client will see. All other origin headers will be hidden.

To enable the option, add the header_filter section when using the ResourceService/Create or ResourceService/Update call:

"header_filter": {
  "enabled": "<true_or_false>",
  "headers": [
    "<list_of_headers>"
  ]
}

Where:

  • enabled: Enabling the option:

    • true enables the option.
    • false disables the option.
  • headers: List of HTTP headers the client will see. All other origin headers will be hidden.

ExampleExample

In this example, you create a CDN resource for a corporate portal that should hide technical origin headers for better security. Only the main headers are allowed the web application needs to work correctly.

  1. Get an IAM token for API authentication and write it into a variable:

    export IAM_TOKEN=`yc iam create-token`
    
  2. Create a CDN resource with header hiding configured:

    cURL
    gRPCurl
    curl \
      --request POST \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://cdn.api.cloud.yandex.net/cdn/v1/resources' \
      --data '{
        "folderId": "b12m81qm6abc********",
        "cname": "cdn-portal.example.com",
        "origin": {
          "originSourceParams": {
            "source": "portal.example.com",
            "meta": {
              "common": { "name": "portal.example.com" }
            }
          }
        },
        "originProtocol": "HTTPS",
        "options": {
          "headerFilter": {
            "enabled": true,
            "headers": [
              "Content-Type",
              "Cache-Control",
              "Content-Length",
              "Last-Modified",
              "ETag"
            ]
          }
        }
      }'
    

    Result:

    {
    "done": true,
    "metadata": {
      "@type": "type.googleapis.com/yandex.cloud.cdn.v1.CreateResourceMetadata",
      "resourceId": "bc8rgivxwhcy********"
    },
    "response": {
      "@type": "type.googleapis.com/yandex.cloud.cdn.v1.Resource",
      "active": true,
      "options": {
      ...
      "headerFilter": {
        "enabled": true,
        "headers": [
        "Content-Type",
        "Cache-Control",
        "Content-Length",
        "Last-Modified",
        "ETag"
        ]
      }
      },
      ...
    },
    "id": "bc8y2mnkri2d********",
    "description": "Create resource",
    "createdAt": "2026-02-05T18:02:30.735628Z",
    "createdBy": "aje9k8luj4qf********",
    "modifiedAt": "2026-02-05T18:02:30.735628Z"
    }
    
    grpcurl \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "folder_id": "b12m81qm6abc********",
            "cname": "cdn-portal.example.com",
            "origin": {
              "origin_source_params": {
                "source": "portal.example.com",
                "meta": {
                  "common": { "name": "portal.example.com" }
                }
              }
            },
            "origin_protocol": "HTTPS",
            "options": {
              "header_filter": {
                "enabled": true,
                "headers": [
                  "Content-Type",
                  "Cache-Control",
                  "Content-Length",
                  "Last-Modified",
                  "ETag"
                ]
              }
            }
          }' \
      cdn.api.cloud.yandex.net:443 \
      yandex.cloud.cdn.v1.ResourceService/Create
    

    Result:

    {
      "id": "bc8h7teov4q7********",
      "description": "Create resource",
      "createdAt": "2026-02-05T18:19:01.262477Z",
      "createdBy": "aje9k8luj4qf********",
      "modifiedAt": "2026-02-05T18:19:01.262477Z",
      "done": true,
      "metadata": {"@type":"type.googleapis.com/yandex.cloud.cdn.v1.CreateResourceMetadata","resourceId":"bc8r4gogfqeb********"},
      "response": {..."options":{..."headerFilter":{"enabled":true,"headers":["Content-Type","Cache-Control","Content-Length","Last-Modified","ETag"]}},...}
    }
    

Was the article helpful?

Previous
Enabling a resource to follow request redirects
Next
Setting up access via a secure token
© 2026 Direct Cursus Technology L.L.C.