Skip to content

/cdn-cgi/image/ breaks dynamic /routes/media URLs #2155

@mrkaashee

Description

@mrkaashee

Hi Nuxt Image team,

I’m using Nuxt Image with the Cloudflare provider and have a dynamic route serving images as blobs: /routes/media/:filename. My config works without quality:

$production: {
  image: {
    format: ['webp', 'avif'],
    provider: 'cloudflare',
    cloudflare: { baseURL: '/' },
  }
}

When I add quality:

$production: {
  image: {
    format: ['webp', 'avif'],
    provider: 'cloudflare',
    cloudflare: { baseURL: '/' },
    quality: 80,
  }
}

Nuxt automatically appends /cdn-cgi/image/ to generate URLs (as noted in the docs):

Note: /cdn-cgi/image/ will be automatically appended for generating URLs.

This breaks my URLs because my dynamic route /routes/media/:filename cannot be fetched correctly via /cdn-cgi/image/....

Question:

How can I use quality (or other optimization options) with a dynamic Nuxt route like /routes/media? Is there a way to make Cloudflare optimization work with dynamic blob routes, or do images need to be served from public/?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions