Object Storage for 1C-Bitrix: SigV4, CORS, CDN

When integrating Yandex Object Storage with 1C-Bitrix, developers often encounter non-obvious problems: SigV4 signature incompatibility, CORS blocking file uploads from the browser, and incorrect CDN caching. A typical Bitrix store stores between 10 and 50 GB of product images in `/upload/`. Moving

Our competencies:

Frequently Asked Questions

When integrating Yandex Object Storage with 1C-Bitrix, developers often encounter non-obvious problems: SigV4 signature incompatibility, CORS blocking file uploads from the browser, and incorrect CDN caching. A typical Bitrix store stores between 10 and 50 GB of product images in /upload/. Moving to cloud S3 storage reduces server load by 40% and speeds up catalog page loading by 2–3 times. We configure cloud storage turnkey: from creating a service account to connecting CDN. Our experience includes over 50 projects for online stores and corporate portals. We resolve these issues in 2–3 days, guaranteeing compatibility with any Bitrix components. The cost of storing 1 GB in Yandex Object Storage starts from $1–1 per month, which is several times cheaper than a dedicated disk array. Total economy: up to $18–26 per month on hosting and traffic for a typical store.

Connection Parameters

Yandex Object Storage endpoint: https://storage.yandexcloud.net. Region: ru-central1. Public URL format: https://[bucket].storage.yandexcloud.net/[key] — virtual hosted style.

In /bitrix/admin/main_cloud_storage.php specify:

  • Storage type: Amazon S3 (compatible)
  • Endpoint: https://storage.yandexcloud.net
  • Region: ru-central1
  • Access Key: static key ID from Yandex Cloud console
  • Secret Key: secret key
  • Bucket: bucket name

Creating a service account and keys: in Yandex Cloud console: IAM → Service Accounts → Create → assign storage.editor role on the bucket → Create static access key.

Setting Up S3-Compatible Storage

The main.cloudstorages module uses the AWS SDK PHP. When connecting to Yandex Object Storage, the SDK may default to the wrong signature version. Yandex supports only Signature Version 4 (SigV4), while the SDK for custom endpoints sometimes tries to use SigV2. Without explicitly specifying the signature, authorization fails. The fix is to add the parameter 'signature' => 'v4' to the client configuration:

$s3Client = new \Aws\S3\S3Client([ 'version' => 'latest', 'region' => 'ru-central1', 'endpoint' => 'https://storage.yandexcloud.net', 'signature' => 'v4', 'credentials' => [ 'key' => $accessKey, 'secret' => $secretKey, ], ]); 

If the module interface does not allow passing this parameter, we edit the provider class (with a backup) or use inheritance. This approach has been tested on dozens of projects.

How to Fix SigV4 Signature Errors?

Official 1C-Bitrix documentation does not provide a ready-made solution. In practice, a patch to /bitrix/modules/main/lib/cloudstorages/amazon.php helps: add 'signature' => 'v4' in the client constructor. Alternatively, override the getS3Client() method in an inherited class. Source: Yandex Object Storage documentation — SigV4 is mandatory.

Configuring CORS for Uploads

When using presigned URLs for direct upload to Object Storage, browsers block requests without CORS headers. In the Yandex Cloud console, in the "CORS" section, add a rule. Follow these steps:

  1. Navigate to the bucket settings in Yandex Cloud Console.
  2. Open the "CORS" tab.
  3. Add a new rule:
<CORSConfiguration> <CORSRule> <AllowedOrigin>https://example.com</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>PUT</AllowedMethod> <AllowedHeader>*</AllowedHeader> <MaxAgeSeconds>3600</MaxAgeSeconds> </CORSRule> </CORSConfiguration> 
  1. Save the configuration.

Without this setting, TinyMCE and custom upload forms will throw an error. We include CORS configuration in the standard scope of work.

Lifecycle Policies for Temporary Files

Yandex Object Storage supports automatic deletion of files older than N days. This is useful for folders /upload/tmp/ and /upload/import/, which Bitrix does not clean. Example rule:

Example lifecycle policy in JSON
{ "Rules": [{ "ID": "cleanup-tmp", "Status": "Enabled", "Filter": { "Prefix": "upload/tmp/" }, "Expiration": { "Days": 7 } }] } 

Configured via console or API. Space savings up to 30% per month on a typical store. For a store with 20 GB of temporary files, this saves about $5–8 per month when stored in the cloud.

How to Set Up CDN?

Yandex Cloud CDN integrates with Object Storage in minutes: create a CDN resource with the bucket as origin, specify the CDN domain in the cloud_storage_cdn_url option. After that, Bitrix generates public URLs through the CDN, and files are served from the nearest point of presence. Parameter in code:

\Bitrix\Main\Config\Option::set('main', 'cloud_storage_cdn_url', 'https://cdn.example.com'); 

Writes go directly to the bucket, reads go through the CDN. For image resizes, this gives a 2–3x speedup in catalog page loading. For Russian projects, Yandex CDN offers the best latency compared to CloudFront — delays are 30% lower thanks to data centers in Moscow and St. Petersburg.

What's Included in Turnkey Setup

We perform the full cycle: creating a service account, CORS configuration, signature patch, lifecycle policies, CDN integration. We provide configuration documentation and backup of original files. We guarantee data integrity and compatibility after Bitrix updates.

Parameter Yandex Object Storage AWS S3
Endpoint storage.yandexcloud.net s3.amazonaws.com
Region ru-central1 (single) us-east-1 and others
Signature SigV4 only SigV2/V4
CORS Required for browser Similar
CDN Yandex Cloud CDN CloudFront
Metric Without CDN With CDN
Image load time (500 KB) ~1.2 s ~0.4 s
Server load 100% up to 20%