Complicating Factors and The Problem-solving Process
Analysis and Setup
Before initiating any solutions, Divio, in collaboration with Compound Partners, conducted thorough fact-finding. A test environment that mirrored the live site was created using Divio’s Web App Mirroring, and Cloudflare was enabled to get a better understanding of what needed to be done.
The Challenges
Editorial Control
A significant issue was ensuring rapid content management to correct or remove sensitive material swiftly. For instance, if an error in commercially sensitive content occurs, it must be rectifiable immediately—even if the content is cached.
Dynamic Content
Another critical challenge stemmed from the site's architecture, which heavily relies on dynamic content. When new content, such as articles or events, is published, it appears in multiple locations across the site. Dynamic content presents a special issue because the solution to the micro-outages relies on caching, as well as WAF (Web Application Firewall, a constantly updated protection against hacking that rolls out every few seconds). Cloudflare caches at a page level, therefore caching all the “related” content as part of the page meant that new content would not appear immediately across the site. Since new content must appear immediately across the site, any caching solution would need to accommodate daily content updates throughout the site.
The Resolutions
Editorial CMS Updates
To address these editorial concerns, Divio and Compound Partners prioritized establishing robust editorial controls. The CMS was enhanced to signal Cloudflare to re-cache a page whenever modifications are made, ensuring updates are reflected instantly. This setup is crucial not only for immediate corrections but also for the frequent minor edits that articles typically undergo within the first week of publication—common practice among content teams to correct small errors swiftly.
Moreover, publishing or unpublishing a page also triggers Cloudflare to cache or uncache that specific URL, providing editors the flexibility to rapidly remove content as needed. Additionally, to support ongoing uptime monitoring, a new functionality was integrated into the CMS admin to manually clear cached content at both individual and site-wide levels, offering editors comprehensive automated and manual control over content visibility.
Dynamic Content Updates
With editorial controls in place, the focus shifted to managing dynamic content effectively. Historically, this was generated via a call to the CMS to populate the latest content as part of the page load. The approach involved refactoring the code within the “related” content plugins. By leveraging JavaScript to dynamically load content after the initial page load, the core content could be cached and delivered via Cloudflare, with dynamic elements populating immediately afterward.
This strategic combination of technological adjustments and innovative problem-solving ensured that the site could handle both the high demands of dynamic content management and stringent editorial requirements efficiently.
Other Considerations
One persistent issue was related to pages containing forms that generate CSRF tokens, which are secure random tokens essential for security. These tokens typically prevent pages from being cached effectively by Cloudflare. This was particularly problematic for campaign pages, which not only contain forms but also tend to attract high volumes of traffic due to successful email marketing campaigns. The need to ensure these pages functioned seamlessly was paramount.
To ingeniously solve this, Divio restructured the form handling by separating the form itself onto a different page and then integrating it into the main campaign page via an iframe. This adjustment allowed the main page to be cached while still maintaining the form’s functionality and security.
Additionally, modifications were made to the Google TagManager setup to ensure that form submissions were accurately attributed to the main campaign page, not the iframe source. This solution effectively balanced high traffic management with precise tracking requirements, ensuring campaign pages performed flawlessly under peak conditions.