Setting up Cloudflare 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

Setting up Cloudflare CDN for 1C-Bitrix

Site on Bitrix serves static files (JS, CSS, images) from same server as PHP. Over 50–100 RPS load server starts choking — not because PHP is slow but because Nginx is busy serving files. Cloudflare CDN removes this load: static served from nearest edge server while origin handles only dynamics.

What to cache and what not to

Cloudflare by default caches files by extension: .js, .css, .jpg, .png, .woff2, .svg and others. HTML and PHP not cached. For Bitrix this is correct behavior — dynamic pages must generate on server.

Exceptions to configure via Page Rules or Cache Rules:

  • /upload/resize_cache/ — cache it. These are image resizes, don't change after generation.
  • /bitrix/cache/don't cache. Bitrix internal cache, not intended for CDN.
  • /bitrix/admin/* — bypass. Admin panel must not be cached.
  • /personal/*, /auth/* — bypass. Personal account, auth forms.

Setting up cache headers

Bitrix by default doesn't set optimal Cache-Control for static files. Nginx usually configured with expires 30d for /upload/ and /bitrix/images/. Cloudflare respects these headers — if server sends Cache-Control: max-age=2592000, Cloudflare caches file for 30 days.

Check Nginx configuration:

location ~* \.(js|css|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|eot)$ {
    expires 30d;
    add_header Cache-Control "public, immutable";
}

Directive immutable tells browser file won't change — browser won't send conditional request (If-Modified-Since). For Bitrix this is correct because Vite/webpack adds hash to filename on each build.

Browser Cache TTL and Edge Cache TTL

Browser Cache TTL — how long browser stores file locally. Set in Cloudflare Dashboard → Caching → Browser Cache TTL. Recommendation: "Respect Existing Headers" — let Nginx manage.

Edge Cache TTL — how long Cloudflare stores file on its servers. By default determined by origin headers. Via Page Rules override: for /upload/ set Edge Cache TTL = 1 month.

Minification and optimization

Cloudflare offers Auto Minify for JS, CSS and HTML. For Bitrix disable HTML minification — it may break <script> inserts in components and inline styles. JS and CSS minification can stay but if you already minify at build stage (Vite, webpack) — Cloudflare minify adds no benefit and only delays on edge.

Polish (image optimization) — enable it. Compresses JPEG and PNG losslessly/lossy. For catalogs with thousands of product photos bandwidth savings reach 20–30%.

Brotli compression — enable it. Cloudflare compresses text responses (HTML, JS, CSS) with Brotli algorithm which is 15–20% more efficient than gzip.

Verifying CDN operation

After setup verify response headers for static file:

  • cf-cache-status: HIT — file served from Cloudflare cache.
  • cf-cache-status: MISS — file requested from origin (first request or cache expired).
  • cf-cache-status: DYNAMIC — Cloudflare doesn't cache this resource (HTML, PHP).

If you see DYNAMIC for .js or .css — check origin doesn't send Cache-Control: no-store or Set-Cookie. Cloudflare doesn't cache responses with Set-Cookie and Bitrix may set session cookie on any request. Make sure Nginx handles static requests directly without passing to PHP.