diff --git a/.changeset/long-suits-care.md b/.changeset/long-suits-care.md new file mode 100644 index 00000000..7c6de55a --- /dev/null +++ b/.changeset/long-suits-care.md @@ -0,0 +1,5 @@ +--- +'@astrojs/cloudflare': patch +--- + +Enables onerror redirect for Cloudflare image service diff --git a/packages/cloudflare/src/entrypoints/image-service.ts b/packages/cloudflare/src/entrypoints/image-service.ts index 08907bd2..5ebbfeb9 100644 --- a/packages/cloudflare/src/entrypoints/image-service.ts +++ b/packages/cloudflare/src/entrypoints/image-service.ts @@ -7,7 +7,7 @@ import { isESMImportedImage, isRemoteAllowed } from '../utils/assets.js'; const service: ExternalImageService = { ...baseService, getURL: (options, imageConfig) => { - const resizingParams = []; + const resizingParams = ['onerror=redirect']; if (options.width) resizingParams.push(`width=${options.width}`); if (options.height) resizingParams.push(`height=${options.height}`); if (options.quality) resizingParams.push(`quality=${options.quality}`);