# strapi-provider-upload-cloudflare

> Strapi provider for uploading to Cloudflare Images

Latest version **4.3.0** (published 2024-12-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install strapi-provider-upload-cloudflare
pnpm add strapi-provider-upload-cloudflare
yarn add strapi-provider-upload-cloudflare
bun add strapi-provider-upload-cloudflare
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.3.0 |
| Published | 2024-12-30 |
| First published | 2022-01-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sanjay Thakur |
| Maintainers | sthakur |
| Keywords | upload, cloudflare, images, strapi |

## Links

- npm: https://www.npmjs.com/package/strapi-provider-upload-cloudflare
- Homepage: https://github.com/sanjay-io/strapi-provider-upload-cloudflare#readme
- Issues: https://github.com/sanjay-io/strapi-provider-upload-cloudflare/issues
- npm.io page: https://npm.io/package/strapi-provider-upload-cloudflare

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.4.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 4.3.0 (latest) — 2024-12-30
- 4.2.0 — 2023-07-02
- 4.1.0 — 2022-07-20
- 4.0.1 — 2022-01-07
- 4.0.0 — 2022-01-07
- 1.0.2 — 2022-01-07
- 1.0.1 — 2022-01-07
- 1.0.0 — 2022-01-07

## README

# strapi-provider-upload-cloudflare

[![npm version](https://img.shields.io/npm/v/strapi-provider-upload-cloudflare.svg)](https://www.npmjs.org/package/strapi-provider-upload-google-cloud-storage)
[![npm downloads](https://img.shields.io/npm/dm/strapi-provider-upload-cloudflare.svg)](https://www.npmjs.org/package/strapi-provider-upload-google-cloud-storage)

**Non-Official** Cloudflare Upload Provider for Strapi

This has only been tested with Strapi 4.

To find your Cloudflare accountId and apiKey, log into Cloudflare and click "Images". On that page you should see "Account ID" under Developer Resources. For apiKey, if you click the "Use API" tab you'll see a link next to "API Token" to generate an apiKey. The only permission that API Token needs is "Account.Cloudflare Images".

If you have multiple image variants the first one will be selected unless you specify the "variant" parameter.

## Installation

```bash
# using yarn
yarn add strapi-provider-upload-cloudflare

# using npm
npm install strapi-provider-upload-cloudflare
```

## Configurations

Your configuration is passed down to the provider.

See the [using a provider](https://docs.strapi.io/developer-docs/latest/plugins/upload.html#using-a-provider) documentation for information on installing and using a provider. And see the [environment variables](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/optional/environment.html#environment-variables) for setting and using environment variables in your configs.

### Provider Configuration

`./config/plugins.js`

```js
module.exports = ({ env }) => ({
  // ...
  upload: {
    config: {
      provider: 'strapi-provider-upload-cloudflare',
      providerOptions: {
        accountId: env('STRAPI_UPLOAD_CLOUDFLARE_ACCOUNT_ID'),
        apiKey: env('STRAPI_UPLOAD_CLOUDFLARE_API_KEY'),
        variant: env('STRAPI_UPLOAD_CLOUDFLARE_VARIANT'),
      },
    },
  },
  // ...
});
```

To get your accountId and apiKey see the top of this README.

### Security Middleware Configuration

Due to the default settings in the Strapi Security Middleware you will need to modify the `contentSecurityPolicy` settings to properly see thumbnail previews in the Media Library. You should replace `strapi::security` string with the object bellow instead as explained in the [middleware configuration](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations/required/middlewares.html#loading-order) documentation.

`./config/middlewares.js`

```js
module.exports = [
  // ...
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        useDefaults: true,
        directives: {
          'connect-src': ["'self'", 'https:'],
          'img-src': ["'self'", 'data:', 'blob:', 'imagedelivery.net'],
          'media-src': ["'self'", 'data:', 'blob:', 'imagedelivery.net'],
          upgradeInsecureRequests: null,
        },
      },
    },
  }, 
  // ...
];
```

## Resources

- [LICENSE](LICENSE)

## Links

- [Strapi website](https://strapi.io/)
- [Strapi documentation](https://docs.strapi.io)
- [Strapi community on Discord](https://discord.strapi.io)
- [Strapi news on Twitter](https://twitter.com/strapijs)

---
_Source: https://npm.io/package/strapi-provider-upload-cloudflare · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
