#CF Proxy Caching Layer for Vercel

6 messages · Page 1 of 1 (latest)

olive sphinx
#

Hey, imagine a website that is highly dynamic and when it's dynamically generated it costs a lot of database resources. It's a multi tenant app, that hosts websites. The customer websites should be fully static (cached via CF) and purged, when something changed.

DNS
The origin is vercel, that serves all pages fully dynamic. I added the correct DNS entries to cloudflare (CF) and it's working fine (see attached).

Caching Rules
To have the correct caching rules I added the following caching rule expression:

(http.host ne "app.domain.de")

With Eligible for cache and Ignore cache-control header and use this TTL TTL 1 year (maximum)
With also Status code TTL: 200; Duration: 1 year (maximum)

Like that it should cache every customer page for 1 year (app.domain.de is the editor itself. That shouldn't be cached)

Results
As you can see attached I get only redirected (should be fine, because I don't want to see CF, I want to see Vercel when there is no cache).
You can also see, that the cache got bypassed. You can see, that I am not on app.domain.de.

How to configure it correctly?

-- [Allow](#off-topic message)
@hardy swallow also: do you use Cache Reserve or Tiered Cache or both or none?

bleak gustBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

hardy swallow
#

i have no idea how one purges cache on cf.. i just use it for static assets that should never change... that being said i think the new cf pages and nextjs thing should in theory give you that control and with i assume revalidatePath #discussions message

olive sphinx
# hardy swallow i have no idea how one purges cache on cf.. i just use it for static assets that...

ah, to purge only a tag, a host or a relative path with host, I would like to use: https://developers.cloudflare.com/api/operations/zone-purge#purge-cached-content-by-tag-host-or-prefix

I saw your post in the past in the discussion channel, but I don't think CF can support everything, that nextjs offer. I guess only vercel offers the support for all nextjs functionalities

olive sphinx
bleak gustBOT