Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
All solutions
    • All solutions for Object Storage
    • Resolving the Bucket not empty error when deleting a bucket from Object Storage
    • Resolving errors of access to a bucket with an assigned security policy
    • Resolving error 429
    • Resolving the "409 BucketAlreadyExists" error
    • Resolving the error of access to S3 buckets from a DataProc 1.4 cluster
    • Resolving error 403 (header is not provided when using the OPTION method)
    • Resolving certificate error
    • Resolving GATEWAY_REQUEST_ERROR
    • Resolving issues with incorrect MIME-types of objects when uploading them to Object Storage
    • Moving data from an Object Storage bucket to an ice storage
    • Restricting access to an Object Storage bucket using an IP range from Cloud CDN
    • Moving bucket contents to another bucket in the same the folder
    • Accessing Object Storage API directly, bypassing the SDK
    • Viewing and deleting incomplete uploads
    • How to determine the speed of data upload and download
    • How to configure cache-control headers for objects in a bucket during HTTP requests
    • How to restrict access to a bucket for a user
    • How to connect your own domain to a bucket
    • How to change the storage class

In this article:

  • Scenario description
  • Solution
  1. Object Storage
  2. How to configure cache-control headers for objects in a bucket during HTTP requests

How to configure cache-control headers for objects in a bucket during HTTP requests

Written by
Yandex Cloud
Updated at February 6, 2025
  • Scenario description
  • Solution

Scenario descriptionScenario description

You need to set up cache-control headers for objects in the bucket during HTTP requests.

SolutionSolution

You can add the Cache-Control header to system metadata during the upload or modification of an object in the bucket. For more details about object metadata, see the documentation.

To add Cache-Control to a previously uploaded object, you can use the s3cmd utility.
To do this, run the following command:

s3cmd --add-header 'Cache-Control:max-age=3600' modify s3://<your-bucket-name>/object-name.

To add the Cache-Control header during the object upload to the bucket using s3cmd, specify the --add-header parameter:

s3cmd --add-header 'Cache-Control:max-age=3600' put local_file s3://<your-bucket-name>/object-name.

Note

You can install and configure the s3cmd utility following this guide.

You can also use the AWS CLI utility to add the Cache-Control header.
Example command for AWS CLI:

aws --endpoint-url=https://storage.yandexcloud.net s3 \
cp local_file s3://bucket_name --cache-control 'max-age=3600'

Was the article helpful?

Previous
How to determine the speed of data upload and download
Next
How to restrict access to a bucket for a user
Yandex project
© 2025 Yandex.Cloud LLC