Next.jsRunbook 0/4 done
next-image-unconfigured-host

Next.js Error next-image-unconfigured-host: next/image hostname not configured

Error✕ Not retryable · fix the payloadHTTP 400 Bad RequestRuntime
TL;DR · 10-second read

next/image only optimizes remote images from hosts allowed in next.config. Add the host to images.remotePatterns (protocol, hostname, optional pathname) and restart the dev server.

Identify: does your log match?

What you see · exact log / response
Error: Invalid src prop (https://images.unsplash.com/photo-1501785888041-af3ef285b470?w=1200) on `next/image`, hostname "images.unsplash.com" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host
  1. High

    Remote host not allowlisted

    Any absolute src URL must match an entry in images.remotePatterns, to stop the optimizer being used as an open proxy.

  2. Medium

    Pattern too narrow

    hostname matches exactly; cdn.example.com does not match example.com, and pathname /img/** does not match /images/.

  3. Low

    Config change without restart

    next.config.js is read at startup, so edits need the dev server restarted.

Fix

Add remotePatterns for the image host

✕ Broken · Next.js
// next.config.ts
const nextConfig = {};
export default nextConfig;
✓ Fixed · Next.js
// next.config.ts
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
  images: {
    remotePatterns: [
      { protocol: 'https', hostname: 'images.unsplash.com', pathname: '/**' },
      { protocol: 'https', hostname: '**.cloudfront.net' },
    ],
  },
};
export default nextConfig;

remotePatterns supports wildcards (** for subdomains/paths) and replaces the deprecated images.domains.

Verify: reproduce it on purpose

Reproduce locally · Next.js
$ printf "import Image from 'next/image';export default function P(){return <Image src='https://images.unsplash.com/x' width={10} height={10} alt=''/>}\n" > app/page.tsx && npx next dev

Run it against a dev environment to trigger next-image-unconfigured-host on purpose and test your error handler.

Prevent

  • Keep patterns as narrow as practical.
  • Restart next dev after editing next.config.
  • Proxy user uploads through your own CDN host.

FAQ

Is images.domains still supported?

It is deprecated since Next.js 14 in favor of remotePatterns, which also restricts protocol and path.

Why does it work in dev but fail on Vercel?

Usually a different image host in production env vars. The error message shows the exact hostname to add.

Can I allow every host?

hostname: '**' works but turns your optimizer into an open image proxy you pay for. Avoid it in production.

Related errors

Last verified 2026-10-19 · Source: Next.js /errors directory (vercel/next.js) · Official docs ↗ · ~14,800 searches/mo