Skip to content

Configuration

All customizations are applied in the src/index.ts file.

Here is all the available options:

NameType(s)DescriptionExamples
readonlyboolean or undefinedControls the write access globally, default: truetrue
corsboolean or undefinedEnables or disables CORS access to the internal API, default: falsetrue
cfAccessTeamNamestring or undefinedWhen set enforces Cloudflare Access in all requestsradar (taken from https://radar.cloudflareaccess.com/)
emailRoutingobject or undefinedCustomize Email Explorer, read more herehttps://demo.r2explorer.com
cacheAssetsboolean or undefinedCache dashboard assets by 5 minutes, default: truetrue

emailRouting options:

NameType(s)DescriptionExamples
targetBucketstring or undefinedBucket name that will receive the emailsmy-emails (assuming my-emails is a real bucket name)

Disabling readonly mode

For security reasons, by default your application will be in read only mode, to disable this, just update your src/index.ts file, like this:

ts:src/index.ts
import { R2Explorer } from 'r2-explorer';

export default R2Explorer({ readonly: false });

After this, just deploy your application normally with:

bash
wrangler deploy

DANGER

Disabling read only mode, allows anyone to upload and change your bucket!

It is highly recommended to enable authentication in your application, read more here

Setup Custom Domain

To setup a custom domain, just open the Cloudflare dashboard and go to Workers & Pages -> your worker -> Triggers. And click "Add Custom Domain".

Cloudflare Workers Dashboard

Configuring Email Explorer target bucket

By default emails will go to the 1º bucket configured in your wrangler.toml file, but you can overwrite it in the index.ts file, like:

ts:src/index.ts
import { R2Explorer } from 'r2-explorer';

export default R2Explorer({
  readonly: false, emailRouting: {
    targetBucket: 'my-email-bucket'
  }
});

After this, just deploy your application normally with:

bash
wrangler deploy

Released under the MIT License.