Reverse Proxy w/ Cloudflare

Level 2 - Caching + Optimization

Overview
Introduction to Reverse Proxies + Webflow
001
What Problems are we Solving?
What Problems are we Solving here?
101
The SSL Problem
102
Maximizing Site Performance
103
Staying Within Webflow's Hosting Plan Traffic Limits
104
Setup & Configurations
Proxy Configuration Approaches
201
Reverse-Proxy DNS Config
202
High Performance Configs
Proxying for Performance
300
Caching Strategy
301
Level 1 - Basic Caching
302
Level 2 - Caching + Optimization
303
Level 3 - Extended Caching + Optimization
304
Level 4 - Advanced Caching + Optimization
306
Administration
How to Determine if an Item is Cached
801
How to Remove a Cached Item
803
Emergency Revert
804
Resources
More Resources
901
No items found.
Published
October 28, 2023
Updated
October 28, 2023
in lightbox

Features all of the Level 1 advantages, plus;

  • Image optimizations like automatic WEBP conversion and resizing
  • More specific caching control, so you can optimize different parts of your site differently
  • Cache analytics to show you how it's performing

These translate into;

  • Reports, you can see exactly what's happening.
  • Performance. Image Optimization means a faster site particularly for mobile users.
  • SEO. That optimized performance means likely better scores with Google Lighthouse and Core Web Vitals, which can improve your SEO rankings.  

Requirements;

  • Cloudflare - PRO plan ( $20/mo )
  • Cassette app - Free plan
  • > May required the paid plan if you want multiple domains for the image optimization
  • Image resizing - PRO plan
  • > Image Resizing is a usage based product. You will be billed on the number of image resize requests performed. Your account includes 50,000 Image Resizing requests per month, after which Image Resizing will cost $9 per every 50,000 requests.

Enhanced Caching Strategy

In the PRO plan, you're have far more page rules, so we can be much more specific about how to handle different parts of your site.

A convenient way to think of your site is as;

  • Homepage
  • Other static pages like About and Contact Us
  • Directory pages, like /blog, or /products, which
  • CMS collection pages, such as individual blog articles, individual products, individual case studies
The important thing to consider here is "how often do these pages change after they're created?"

Note this is not the same as adding a new page. If you add a new blog article, it will be created as a new page which is not in the cache, and it will be seen immediately. If you edit an existing blog article, it will likely be cached and your changes will only be seen once the cache expires.

General Configuration

Speed > Optimization > Image Optimization

  • Image Resizing ( PRO, usage-based ) - ON, any origin
  • Polish ( PRO ) - ON ( Lossy, WebP )
  • Mirage ( PRO ) - ON

Speed > Optimization > Protocol Optimization

  • Enhanced HTTP/2 Prioritization ( PRO ) - ON

Recommended Page Rules

In the URLs where DOMAIN is indicated, use your own custom base domain without the www.

RULE 1: Ignore dynamic feeds ( /sitemap.xml & RSS )

URL - *DOMAIN/*.xml ( e.g. *sygnal.com/*.xml )

  • Cache Level - Bypass

RULE 2: Cache assets ( Images )

URL - *assets.DOMAIN/* ( e.g. *assets.sygnal.com/* )

  • Auto Minify - HTML, CSS
  • Browser Cache TTL: 8 days
  • Cache Level - Cache Everything
  • Edge Cache TTL - a month
  • Automatic HTTPS Rewrites - ON
  • Opportunistic Encryption - ON
  • Mirage ( PRO )- ON
  • Polish ( PRO ) - Lossy

RULE 3+: Custom content rules

Here you'll create your specific rules for each set of pages you want to set distinct caching rules for.

Make sure to read up on how to set your URL wildcards to target the correct pages, for example, to target your /blog static directory page you might use-

URL - *DOMAIN/blog ( e.g. *sygnal.com/blog )

But to target your blog article pages-

URL - *DOMAIN/blog/* ( e.g. *sygnal.com/blog/* )

Adapt RULE N, below. Primarily the difference will be the cache durations you use;

  • Edge Cache TTL: ( depends on your needs )
  • Browser Cache TTL: ( depends on your needs )

RULE N: Cache everything else

URL - *DOMAIN/* ( e.g. *sygnal.com/* )

  • Auto Minify - HTML, CSS
  • Browser Cache TTL: a day
  • Cache Level - Cache Everything
  • Edge Cache TTL - a day
  • Automatic HTTPS Rewrites - ON
  • Opportunistic Encryption - ON
  • Mirage ( PRO )- ON
  • Polish ( PRO ) - Lossy

Advanced Notes

Cassette is does not provide any special handling for the /robots.txt file, and it appears to simply pass through the one from the S3 bucket.

In Webflow's case, this means a 403 Forbidden error;

https://assets-global.website-files.com/robots.txt

Does this matter?

Perhaps. Ideally, we want all of our assets indexed on our site so there is potentially a benefit to having a robots.txt which allows all. Or failing that, a simple 404.

As I write this, I'm researching ways around this issue but it is difficult to find a configuration that can override the app's behavior of returning the 403.

If SEO is especially important to you, I'd consider Level 3 which replaces cassette with a custom worker that you can configure.

FAQs

Answers to frequently asked questions.

Videos
No items found.
Table of Contents
Comments
Did we just make your life better?
Passion drives our long hours and late nights supporting the Webflow community. Click the button to show your love.