#Does astro support Incremental Static Regeneration on cloudflare?

1 messages · Page 1 of 1 (latest)

stiff jasper
#

CloudFlare say it supports NextJs but I don't know if CF supports any similar feature of Astro?

solid pierBOT
#

Hi @stiff jasper. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

stiff jasper
#

Does astro support Incremental Static Regeneration on cloudflare?

solid pierBOT
#

Yes, Astro supports Incremental Static Regeneration (ISR) on Cloudflare, but it's called "on-demand rendering" in Astro terminology. This feature is available when using the @astrojs/cloudflare adapter.

According to the Astro documentation on Cloudflare deployment, you can build an Astro SSR site for deployment to Cloudflare Pages using the @astrojs/cloudflare adapter. This adapter enables on-demand rendering, which is similar to Incremental Static Regeneration in Next.js.

To set this up, you need to:

  1. Install the Cloudflare adapter:
npx astro add cloudflare
  1. Update your astro.config.mjs file to use the adapter and set the output mode to 'server':
import { defineConfig } from 'astro/config';
import cloudflare from '@astrojs/cloudflare';

export default defineConfig({
  output: 'server',
  adapter: cloudflare()
});

By configuring your Astro project this way, you can take advantage of on-demand rendering on Cloudflare, which is functionally similar to Incremental Static Regeneration in Next.js.

For more detailed information on setting up and deploying Astro with Cloudflare, you can refer to the Astro Cloudflare integration guide.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: