Caching & Performance
Cloudflare speeds up your website by caching static content at edge servers around the world. When a visitor requests your site, Cloudflare serves cached files from the nearest data center instead of fetching them from your hosting server every time, reducing load times and saving server resources.
How Cloudflare Caching Works
Cloudflare operates a global network of data centers (edge servers). When someone visits your site for the first time, Cloudflare fetches the content from your Ultra Web Hosting server (the origin) and stores a copy at the edge. Subsequent visitors in the same region receive the cached copy directly from Cloudflare, which is significantly faster because the data travels a shorter distance.
What Gets Cached by Default
Cloudflare automatically caches static file types based on their extension. These include:
- Images:
.jpg,.jpeg,.png,.gif,.webp,.svg,.ico - Stylesheets:
.css - JavaScript:
.js - Fonts:
.woff,.woff2,.ttf,.eot - Documents:
.pdf,.doc,.xls
What Does NOT Get Cached
By default, Cloudflare does not cache:
- HTML pages — because they often contain dynamic content that changes per visitor.
- PHP responses — server-side scripts are always forwarded to your origin server.
- API responses — JSON and XML endpoints are passed through to the server.
This means your dynamic WordPress pages, login forms, and shopping carts will always be served fresh from the server, while your images, CSS, and JS files benefit from Cloudflare's edge caching.
Browser Cache TTL
The Browser Cache TTL (Time to Live) setting controls how long a visitor's browser keeps cached files before requesting a fresh copy from Cloudflare. You can configure this in your Cloudflare dashboard.
- Log into your Cloudflare dashboard.
- Select your domain.
- Go to Caching → Configuration.
- Find Browser Cache TTL and choose a duration.
A longer TTL (e.g., 1 month) means returning visitors load your site faster because their browser reuses cached files. A shorter TTL means visitors get updated content sooner. For most sites, the default setting of 4 hours or Respect Existing Headers works well.
Caching Level Options
Cloudflare offers three caching levels that determine how URLs with query strings are handled:
- No Query String: Only caches files when the URL has no query string. For example,
style.cssis cached butstyle.css?v=2is not. - Ignore Query String: Caches files regardless of query strings. Both
style.cssandstyle.css?v=2serve the same cached file. - Standard (recommended): Caches files with different query strings as separate resources.
style.css?v=1andstyle.css?v=2are cached independently.
The Standard setting is the best choice for most websites, especially WordPress sites that use query strings for cache-busting when you update themes or plugins.
Purging the Cache
When you update your website (new images, updated CSS, etc.), Cloudflare may still serve the old cached version until it expires. You can force Cloudflare to fetch fresh content by purging the cache.
Purge Everything
- In your Cloudflare dashboard, go to Caching → Configuration.
- Click Purge Everything.
- Confirm the action.
This clears all cached files across all Cloudflare data centers. Your site may load slightly slower for the first few visitors afterward as caches are rebuilt.
Purge by URL
If you only changed a specific file (for example, a single image or stylesheet), you can purge just that file instead of clearing the entire cache:
- In your Cloudflare dashboard, go to Caching → Configuration.
- Click Custom Purge.
- Enter the full URL of the file you want to purge (e.g.,
https://yourdomain.com/images/logo.png). - Click Purge.
Auto Minify
Auto Minify removes unnecessary whitespace and comments from your CSS, JavaScript, and HTML files, reducing their size and improving load times. This happens on-the-fly at Cloudflare's edge without modifying your original files.
- In your Cloudflare dashboard, go to Speed → Optimization.
- Under Auto Minify, enable the toggle for JavaScript, CSS, and/or HTML.
Rocket Loader
Rocket Loader defers the loading of all JavaScript on your page until after the page content has rendered. This can significantly improve the perceived load time because visitors see your content before scripts finish loading.
- In your Cloudflare dashboard, go to Speed → Optimization.
- Toggle Rocket Loader on.
Polish (Image Optimization)
Polish is a Cloudflare Pro feature that automatically optimizes images served through Cloudflare. It offers two modes:
- Lossless: Reduces file size without any visible quality loss by stripping metadata and applying lossless compression.
- Lossy: Applies more aggressive compression for smaller files with a slight reduction in quality that is generally not noticeable.
Polish can also serve images in WebP format to browsers that support it, which is typically 25-30% smaller than JPEG or PNG.
Cloudflare Caching with LiteSpeed Cache
Your Ultra Web Hosting account runs on LiteSpeed Web Server, which includes its own powerful server-side caching. When you use Cloudflare together with LiteSpeed Cache, they work as two layers of caching that complement each other:
- LiteSpeed Cache (server-side): Caches the full HTML output of your dynamic PHP/WordPress pages on the server. This means when Cloudflare requests a page from your origin, it gets a pre-built HTML file instead of waiting for PHP to generate it.
- Cloudflare (edge/CDN): Caches static assets (images, CSS, JS) at edge servers worldwide and delivers them to visitors from the nearest location.
Together, LiteSpeed Cache eliminates the PHP processing overhead on the server, and Cloudflare reduces the distance static files travel to reach your visitors. This is the ideal setup for fast page loads.
Best Setup for WordPress
- Install the LiteSpeed Cache plugin in WordPress (it is pre-installed on most Ultra Web Hosting accounts).
- Enable page caching in the LiteSpeed Cache plugin settings under Cache → Cache → set Enable Cache to On.
- In the LiteSpeed Cache plugin, go to CDN → enable Cloudflare API and enter your Cloudflare API credentials. This allows the plugin to automatically purge the Cloudflare cache when you update content in WordPress.
- In Cloudflare, keep the caching level set to Standard and avoid enabling page rules that cache HTML unless you know what you are doing.
Checking if Content is Cached
You can verify whether Cloudflare is serving cached content by checking the CF-Cache-Status header in the HTTP response. Open your browser's developer tools (press F12), go to the Network tab, reload the page, and click on a static resource like an image or CSS file. Look for the CF-Cache-Status header in the response headers:
- HIT: The file was served from Cloudflare's cache. This is what you want to see.
- MISS: The file was fetched from your origin server. The next request should be a HIT.
- BYPASS: Cloudflare was instructed not to cache this file (e.g., by a page rule or cache-control header).
- DYNAMIC: The resource type is not cached by default (e.g., HTML pages). Cloudflare passed the request straight through to your server.
- EXPIRED: The cached copy had expired and Cloudflare fetched a fresh copy from the origin.
You can also check from the command line:
curl -I https://yourdomain.com/image.jpg
Look for the cf-cache-status line in the output.