Yeni Alımlara Özel Türkiye Lokasyon (VDS/VPS) Ürünlerinde %50 İndirim Fırsatı! Kaçırmayın... (Stoklarla Sınırlıdır)

Arama Yap Mesaj Gönder

Biz Sizi Arayalım

+90
X
X
X
X

Knowledge Base

Homepage Knowledge Base General What are Cloudflare Cache Rules, Wh...

Bize Ulaşın

Konum Halkalı merkez mahallesi fatih cd ozgur apt no 46 , Küçükçekmece , İstanbul , 34303 , TR

What are Cloudflare Cache Rules, What are They For, and How to Use Them? A Step-by-Step Guide

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.


What are Cache Rules?

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.


Where are they used?

  • 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


Step-by-Step Cache Rule Creation (Based on the Example in the Image)

1. Enter the Cache Rules Panel

  • Log in to your Cloudflare account

  • Follow the path Caching > Cache Rules from the left menu

  • Click the "Create rule" button

2. You Can Choose From Ready-Made Templates or Define a Custom Rule

  • 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.)

3. Create Your Own Rule

  • Give a descriptive name to the "Rule name" field (example: Cache Static Files)

4. Determine the Conditions (if incoming requests match...)

  • 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.

5. Next Steps (Then...)

  • 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?

6. Saving and Publishing

  • Activate it by pressing the "Deploy" button

  • Alternatively, you can save it as a draft with "Save as Draft"


Tips and Best Practices

  • 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


Things to Consider

  • 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.


Conclusion

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. 

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(1265 times viewed / 68 people found it helpful)

Call now to get more detailed information about our products and services.

Diğer Hizmetlerimiz

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.

Top