Setting up a CDN for 1C-Bitrix

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Configuring CDN for 1C-Bitrix

A CDN (Content Delivery Network) for Bitrix serves two purposes: it reduces the loading latency for static assets for users who are physically distant from the server, and it offloads the main server from serving files. For a store with an audience spread across a large country, the difference between a nearby city and a distant one without CDN is 150–200 ms just for DNS resolution and TCP connection setup. With a CDN Point of Presence close to the user, static assets are served with 5–15 ms latency.

What Goes on CDN

Static resources that require no server-side processing: CSS and JS files from /bitrix/cache/css/, /bitrix/js/, /upload/, images and media files, fonts, favicons and icons. Dynamic pages (PHP-generated HTML) are not cached on CDN — unless full-page CDN caching is enabled, which requires dedicated implementation for Bitrix.

Integration with the Bitrix CDN Module

Bitrix has a built-in bitrix.cdn module (available from the "Business" edition). Once activated, it rewrites URLs of static resources in HTML to the CDN domain. Configuration in Settings → Performance → CDN:

  • CDN domain (e.g. cdn.mysite.com or a CNAME to the provider)
  • Path masks for CDN offloading (/upload/*, /bitrix/cache/*)
  • Exclusions (paths that should not be offloaded)

If the CDN module is not used, URL rewriting is implemented via nginx sub_filter or at the CDN provider level with a caching rule based on file extensions.

Choosing a CDN Provider

Popular providers with good coverage: Cloudflare (free plan sufficient for starting out, PoP in major cities), G-Core Labs (regional PoPs, suitable for local compliance requirements), Selectel CDN (integration with local infrastructure), KeyCDN (for international projects).

Cloudflare additionally provides DDoS protection and the ability to proxy all traffic — this changes the integration architecture since the real server IP is hidden behind Cloudflare.

Cache Policy and Invalidation

Correct Cache-Control for Bitrix static assets: files with a hash in their name (generated by Bitrix during compression) can be cached for a year (max-age=31536000, immutable). Files without a hash (style.css, script.js) — no more than one day with must-revalidate.

CDN cache invalidation after a template or JS update: most providers offer an API for purge by URL or patterns. This can be automated via a deploy hook or the Bitrix event OnAfterUpdateStaticFiles.

Case Study and Timeline

An online store with an audience in a geographically large region. After connecting a CDN, page load time for distant users dropped from 3.8 s to 1.4 s — solely due to static asset delivery. The PHP layer was not changed.

Setting up CDN for Bitrix takes 1–2 days: choosing a provider and registering, configuring CNAME/SSL, setting up the CDN module or nginx, verifying which resources are being cached, and testing invalidation. SSL certificates for the CDN domain are typically issued automatically by providers via Let's Encrypt or their own CA.