All sites on our servers run through a unified high-performance web server layer that manages SSL termination, load balancing, and caching, while Apache processes PageSpeed optimizations and executes your PHP application.
The caching layer respects the cache directives defined by your application and the headers generated by Apache. Any cache-related rules you configure in your application or through overrides in your .htaccess file influence how the cache behaves.
Within the Admin Panel, caching can be disabled, limited to static assets (default), or extended to full-page caching that also includes HTML.
Servebolt’s caching system is built as a zero-maintenance, general-purpose performance cache engineered for speed and reliability.
Examination of cache headers
Many frameworks modify headers and set policies that are convenient for developers, rather than optimising them for performance within a production site. This is why it’s essential to check how your application behaves. This can be done by checking the headers of elements using your browser’s developer tools.
In the following example, we are examining a CSS file generated by Magento. Magento overrides our server’s default settings of 10 minutes by setting the “Expires” header one week into the future. This means that both our front-end server and your web browser are told not to re-request this file before it expires.
This behaviour can cause trouble while developing because the CSS file does not refresh, even though you, as a developer, have changed the file. To overcome this, several options are available, but the simplest is to add a new and unique parameter to the file. For instance, a reference in HTML to styles.css could be rewritten as styles.css?v=1. When the non-cached HTML changes, this element will be treated as new by both our front-end web server and the browser, and will thus always display the latest version number.
Servebolt Admin Panel Settings
Each site on your Bolt has a settings page in the Servebolt Admin Panel. There are three different cache settings available. They control the behaviour of the web server (apache)
Caching: Off – Development mode
When caching is disabled, Apache processes every request dynamically and serves each file directly from the file system. This approach consumes more resources and results in significantly slower page loads, so it should be used only during development.
When Development mode is enabled, caching is also automatically set to Off.
Headers only – Ask client browser to cache static assets (images, css, etc..)
Caching of static files is the preferred and default setting. In this mode, elements such as images, JavaScript files, and style sheets are cached according to the headers provided by your web application or the Servebolt standard setup.
The Servebolt standard setup is optimised for good performance and a high level of developer convenience. Caching of static elements reduces the load on the back-end web server and speeds up the loading of web pages.
The period of time an element is cached for varies on an HTTP response code basis:
- 200 (OK) 30 minutes
- 301 (Redirect) 5 minutes
- 404 (Page not Found) 1 minute
Static files get a 7-day expiry header, which means that the elements are cached for up to 7 days in Apache and the user’s browser.
Headers and dynamic caching – Headers for static resources and cache PHP pages
This setting allows caching for HTML and PHP output. For PHP applications, this will require that headers are correctly set.
For Magento 2 and WooCommerce, we maintain plugins that can be installed on your website and modify the default behaviour of these applications to conform to standards. You can find them here:
- WordPress: Servebolt Optimizer
- Magento 2: M2Cache