Setting up a 1C-Bitrix composite cache

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 Composite Cache in 1C-Bitrix

Composite mode is one of the few Bitrix tools capable of reducing TTFB from 800 ms to 20–50 ms without changing the server infrastructure. The principle: the first request to a page is executed fully (PHP + DB), the result is saved as static HTML in /bitrix/cache/html/, and subsequent requests are served directly from the file via nginx — PHP is not invoked at all. Dynamic blocks (cart, username, stock quantities) are replaced by AJAX requests after the page loads.

Requirements and Preliminary Setup

For composite mode to work:

  • A "Business" licence or higher (unavailable on "Start" and "Standard")
  • The bitrix.composite module (installed from the Marketplace; built in on older versions)
  • Correct nginx configuration to serve the HTML cache without PHP

The nginx configuration is the critical point. Without it, composite mode works at half capacity: HTML is saved, but PHP is still invoked to check the cache. The server block needs a condition that checks for the cache file and serves it directly:

set $composite_cache "";
if (!-f $document_root/bitrix/cache/html/$host$request_uri/index.html) {
    set $composite_cache "no";
}
if ($composite_cache = "") {
    rewrite ^ /bitrix/cache/html/$host$request_uri/index.html last;
}

The exact configuration depends on the Bitrix version and site structure — the official documentation provides several variants for different URL schemes.

Marking Dynamic Zones

The primary cause of composite mode problems is incorrect marking of dynamic blocks. Everything that must not end up in the static cache is wrapped in the bitrix:nocache tag:

<?$APPLICATION->IncludeComponent("bitrix:sale.basket.basket", ".default",
    array("CACHE_TYPE" => "N"), false);?>

Or in the component template via $this->addExternalCSS and explicit markers. In modern projects, dynamic zones are moved into separate AJAX endpoints and loaded via BX.ajax after the page loads.

Typical blocks requiring nocache: cart and item counter, authorisation block / username, comparison widgets, personalised recommendations, stock quantities if they change frequently.

Case Study: News Portal on Bitrix

A portal with 40,000 unique daily visitors, predominantly anonymous users. TTFB on article pages — 650–900 ms, server under load during peak hours. After configuring composite mode for article pages (only the "latest comments" block is dynamic, loaded via AJAX) TTFB dropped to 15–30 ms. Load on PHP-FPM fell so dramatically that the number of workers had to be reduced — they were sitting idle.

Limitations and Anti-Patterns

Composite mode does not work for authenticated users by default — they always go through the full PHP cycle. There is a personalisation mode (bitrix:composite.async), but it requires dedicated implementation. Also, pages with POST parameters and pages on the exclusion list (/personal/, /order/) are cached.

A common mistake — enabling composite globally without nocache markup in the right places. Result: one user's data ends up in cache and is displayed to another user. This is not discovered immediately and creates serious security issues.

Configuration Phases

Configuration takes 1 to 3 days depending on the complexity of the template and the number of dynamic blocks. Includes a component audit on the page, nginx configuration, nocache zone markup, migrating dynamic blocks to AJAX, and testing under various scenarios (anonymous, authenticated, mobile).