Getting Started
Cloudflare R2

Adding a Cloudflare R2 Source

Cloudflare R2 Source connects to an existing Cloudflare R2 Object Storage. imgix connects using the credentials you supply, so your Cloudflare R2 assets don't have to be public.

Setting Up Your Cloudflare R2 Source

  1. Go to the Sources page (opens in a new tab) in the imgix dashboard and click the New Source button.

  2. Select Cloudflare from the How do you store your media? radio options.

Screenshot-Cloudflare-R2-source setup

  1. Fill in the details for your Cloudflare R2 Source.

Screenshot-Cloudflare-R2-source setup

Note: We strongly recommend creating R2 access keys specifically for imgix to access your R2 Object Storage with. Keep in mind that imgix only requires Read and List permissions to begin serving your assets. For more information on how to generate your Access and Secret Access Keys or where to find other bucket details see the Cloudflare R2 Guide documentation.

  1. Name the Subdomain you'd like to use as the base URL for your assets.

Screenshot-Cloudflare-R2-source setup

Note: The subdomain name you choose is unique to your Source and can't be re-used. If you're setting up a Source with a lot of customization (particularly a Custom Domain), choose the name you plan to use going forward.

  • If you are editing an existing Source and the Video API is enabled, the imgix Video Subdomain field will be visible. This field automatically inherits the value from your imgix Image Subdomain and cannot be modified without changing the Image Subdomain.
  1. Click the Save button on Step #3 to queue your Source for deployment.

Screenshot-Cloudflare R2 source setup

Cloudflare R2 Guide

We strongly recommend creating R2 access keys specifically for imgix to access your R2 Object Storage with. All Cloudflare R2 credentials are stored using industry standard cryptographic best practices.

Advanced Settings

See the Advanced Source Settings for information about setting up custom domains, defaults, and cache TTL options.


To upload images and videos directly to your cloud-storage-backed Cloudflare R2 Source, you will have to create a separate set of upload_credentials. To upload to your Source directly through Asset Manager, you will also have to update your bucket’s CORS configuration. Uploading should only be implemented post-Source-deployment.

imgix’s rendering service does not need Write permissions to fetch assets; therefore, we highly recommend that you do not use the same credentials for your upload_credentials and your deployment_credentials.