0

I’m using Next.js 16.0.1 and loading images from a Directus /assets/<id> endpoint.

The Directus asset URL works fine in the browser: https://<directus-domain>/assets/<id>

But when Next.js tries to optimize it, the request fails: /_next/image?url=https://<directus-domain>/assets/<id>&w=1920&q=75

Directus returns: "url" parameter is not allowed

✔️ Working examples

<img src={`${DIRECTUS_URL}/assets/${id}`} />

<Image rc={`${DIRECTUS_URL}/assets/${id}`} alt="image" fill unoptimized />

❌ Not working (Next.js optimized image)

<Image rc={`${DIRECTUS_URL}/assets/${id}`} alt="image" fill />

My Next.js config

images: {
  remotePatterns: [
    {
      protocol: "https",
      hostname: "<directus-domain>",
      pathname: "/assets/**",
    },
  ],
}

Question

How can I configure Directus to allow requests like: /_next/image?url=https://<directus-domain>/assets/<id>

without rejecting them with "url" parameter is not allowed"?

Which Directus .env settings need to be update

d to permit this or anything else?

1 Answer 1

0

It might be worth checking if your directus domain is inserted correctly (i.e. without the https:// protocol). Also I would consider relaxing the pathname parameter (e.g. * ) to rule out configuration error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.