Cloudflare Cache Rules are an advanced caching management system that allows you to determine which resources of your website will be cached and for how long. Cache settings, which were previously only made through Page Rules, have now become much more flexible with Cache Rules, which is a more detailed and rule-based system.
In this article, we explain in detail the Cloudflare Cache Rules feature, how to create rules, for which situations it is useful, and we present practical examples step by step.
Cache Rules allow you to determine what will be cached and what will not be cached on Cloudflare's edge servers. Thanks to this system:
You can define different cache behaviors for specific file types,
Specific URL patterns,
And custom filter conditions.
It offers the possibility to customize cache control, especially for dynamic sites, media sites, or web applications serving a large number of users.
Caching static content for a long time (CSS, JS, image files)
Excluding dynamic content under a specific folder from the cache
Activating cache only on specific URLs
Applying different TTL rules on a subdomain basis
Exempting API endpoints with special parameters from the cache
Log in to your Cloudflare account
Follow the path Caching > Cache Rules
from the left menu
Click the "Create rule" button
Cache Everything: Caches all requests
Bypass Cache for Everything: Excludes all requests from the cache
Cache Default File Extensions: Applies cache for specific extensions (jpg, css, js, etc.)
Give a descriptive name to the "Rule name" field (example: Cache Static Files
)
Select Custom filter expression
For example: You can define filters such as URI Full
, wildcard
, *.jpg
(http.request.full_uri wildcard "*example.com/static/*")
This example targets all files in the /static/
directory.
Cache eligibility
: Select "Eligible for cache"
Edge TTL
: How long should it be kept in the cache on the edge server?
Browser TTL
: How long should it be cached in the browser?
Serve stale while revalidating
: Serve the old content until it is updated, even if the cache expires
Origin error page pass-through
: Should errors from the origin be served as is?
Activate it by pressing the "Deploy" button
Alternatively, you can save it as a draft with "Save as Draft"
Create a cache bypass rule for dynamic content (e.g. /login, /cart)
Use long TTL values for static content (e.g. 1 month)
Use version (v=1.2.3) in file names to avoid the need for CDN cache clearing
Check the Respect strong ETags
and Cache key
settings for developers
Cache is not always good. If user-specific data is cached, privacy issues arise.
User cart etc. areas should be excluded from the cache in systems such as WooCommerce, WordPress.
Remember to clear the Cloudflare cache (Purge Cache) after each change.
Cloudflare Cache Rules is a powerful tool to make performance and resource management as efficient as possible. It offers much more detailed, logical filtering and customization than the old "Page Rules" method. When configured correctly, it both reduces the server load and provides a faster experience for the user.
After creating the rules, remember to analyze them regularly and examine their effects from the Analytics & Logs > Cache
section when necessary.
Web siteniz için uygun fiyatlı Ucuz Hosting Paketleri ile yüksek performanslı barındırma hizmeti sunuyoruz.
Dijital varlığınızı güçlendirmek için profesyonel Sosyal Medya Hesap Yönetimi hizmeti sağlıyoruz.
Görsellerinizi sıkıştırmak için kullanışlı PNG to WebP dönüştürücümüzü deneyin.
Resim boyutlarını küçültmek isteyenler için JPG to WebP aracı idealdir.
SEO uyumu için Robots.txt Oluşturucu aracımızı kullanabilirsiniz.
Htaccess Oluşturucu ile yönlendirme ve erişim ayarlarınızı kolayca yapın.
Kullanıcı deneyimini artırmak için özgün UI/UX Tasarım çözümleri sunuyoruz.
Hızlı ve güvenli kurulum için WordPress hizmetimizden faydalanın.
Sitenizi arama motorlarında yükseltmek için Google Optimizasyon hizmeti sunuyoruz.
Markanızı tanıtmak için Tanıtım Yazısı içerikleri üretiyoruz.
UGC ile içerik gücünüzü artırın: UGC İçerik.
Profesyonel Yazılım Kurulum hizmetleri sunuyoruz.
Kaliteli içerik arayanlara özel Hazır Makale & İçerik Satışları.
Sıra Bulucu ile arama motoru sıralamanızı takip edin.
Google Haritalara Kayıt ile konumunuzu haritada gösterin.
Alan adı otoritenizi öğrenin: DA PA Sorgula.
Dış bağlantılarınızı analiz edin: Dış Link Aracı.
Dahili link yapınızı inceleyin: İç Link Aracı.
Arama motoru başarınızı artırmak için SEO Danışmanlığı alın.
Organik trafiğinizi artırmak için SEO çözümleri geliştirin.
Özel çözümler için Mobil Uygulama geliştirme hizmeti sunuyoruz.
Markanız için Logo tasarlıyoruz.
İşinize özel Web Yazılım çözümleri sunuyoruz.
Kurumsal imajınızı yansıtan Kurumsal Web Tasarım hizmeti.
Süreçlerinizi hızlandırmak için Bot Program geliştiriyoruz.
Online satışlarınız için Sanal POS sistemleri sunuyoruz.
Entegrasyonlar için Pazaryeri ve Kargo Entegrasyonu.
Kullanıcı deneyimi testleri için Son Kullanıcı Testleri.
İçerik indirimi için TikTok Video İndir aracı.
Görsellerinizi kolayca küçültün: Resim Boyutlandırma.
Yararlı kod örnekleri için Site Kodları rehberine göz atın.
Kodları online inceleyin: HTML Viewer.
IP adresinizi öğrenmek için IP Adresim Nedir aracını kullanın.
Bağlantı hızınızı test etmek için Hız Testi.
DNS önbellek sorunları için DNS Cache Problemi sayfasını inceleyin.
DNS değişikliklerini görmek için DNS Önizleme aracı.
IDN dönüştürme için IDN Çevirme kullanın.
Sunuculara ping atmak için Ping Gönder özelliğini deneyin.
Web sitenizin yanıt süresini test etmek için Web Site Ping aracımızı kullanın.