How to use Cloudflare CDN with a heroku app

I would like Cloudflare CDN to serve my static assets for my heroku based app. I have found the instructions for cloudfront, which is to do

config.action_controller.asset_host = "<YOUR DISTRIBUTION SUBDOMAIN>

How do I do this with Cloudflare?

I glanced at the instructions, and my guess is that you would have to either upload your assets to either pages or R2 and use a worker to serve them until public buckets are released.

Thank you for your reply.

When you say ‘instructions’ do you mean the Heroku page entitled 'Using Amazon CloudFront CDN`?

If so, are you saying that Cloudflare does not have the functionality to do this in the simple way that is possible with Cloudfront, or are you saying that there are a number of steps I need to take on Cloudflare before I can do use the Cloudfront method.

Thinking about this further, I think you are referencing the Heroku page entitled `Using Amazon CloudFront CDN’. Unfortunately, I have not used Cloudflare for anything complex so do not understand your instructions. I someone able to give a step by step guide on how do this. Or is this the wrong forum to ask, should I try Stack Overflow instead?

Step 1: in the Cloudflare DNS control panel for your zone :orange: the host name you are using for your heroku app.
Step 2: There is no step 2.

1 Like