Cloudflare Workers SSR costs (Pages/Workers)

Hi All,
I am trying to determine if Cloudflare Workers/Pages (with functions) is right for me, I am currently using with a few server-side rendered apps.

So my understanding is that Cloudflare Pages with Functions or Workers with say HonoJS generating an SSR site will cost per request… Favicon is a request, CSS is a request, Embedded Images are a request, Client side JS, the page itself is a request etc etc…

So a single page alone could have multiple requests, even though Cloudflare is generous with both the free plan and paid $5 plans I can see a fairly used site with medium traffic using that in no time at all.

Surly this will add up and be quite costly, Can anyone give me an idea of the cost or a fairly busy / Medium-traffic website (I know this is a general/open-ended question)…

But how much do you pay?, Do you use Cloudflare for full stack SSR sites/apps ? …
and what are your experiences with the platform ?

Many Thanks in Advance,

For Pages, you should only be charged for the requests actually handled by the Function (SSR). Static assets will always be free.

Most frameworks will handle this (such as Remix, SvelteKit, Astro, etc).

It looks like even Hono handles this :slight_smile:

For Workers themselves, yes, you’d be charged every request since every request hits the Worker (the Worker serves the asset)

1 Like

Hi Walshy,
Thank for that… I will have a look at Hono with Pages…

But with a framework like SvelteKit and Astro (Deploy an Astro site · Cloudflare Pages docs) it looks like all requests are SSR which will occur a cost.

I particularly like the look of Astro but how can I have say 25% of the pages via SSR and 75% static… Only way I can think of is to build the 75% and then somehow render the rest with functions (if I was using CF Pages).

With these frameworks there doesn’t seem to be a way of best of both worlds, so I need to choose either my site in SSR or SSG.

Just trying to get my head around it and understand the possible costs.

Its a tricky one :thinking:

What gives you the idea that all requests are paid? For these frameworks, they do only run Functions when needed (doing SSR) not when serving static assets. That continues to just hit Pages and is free.

If they generate an _routes.json (like Astro and others do) then they invoke Functions for the requests needed - Routing · Cloudflare Pages docs

You can see the Astro docs talking about this here:

Frameworks can generate their own or if using the functions folder (such as Hono does) then we can generate it for you.

Hi WalshyMVP,
So I just ran some tests based on the links/info you provided above… Yes it generates a “_routes.json” file (which is written over each build) which excludes common/static files that are in the public folder…


But I can’t choose eg files in folder “A” are SSR and generated on the fly by Cloudflare, but files in folder “B” are static (after the build process) and are not to be generated by Cloudflare as they were built during build time.

I understand the public folder is the solution to this problem but these frameworks mostly seem to be all pages SSR or all pages SSG not in-between. This is where I think the costs can add up.

Hey thanks for your time and feedback :slight_smile:

You can always leave a suggestion for the framework you wish to use :wink:

Some frameworks also probably let you configure your own so you can have that level of control.

1 Like