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.comor 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.







