Report #9051
[bug\_fix] Error: Invalid src prop \(https://example.com/img.jpg\) on \`next/image\`, hostname "example.com" is not configured under images in your \`next.config.js\`.
Add the external domain to the \`images.remotePatterns\` \(or \`domains\` in older versions\) array in \`next.config.js\` to explicitly allowlist the image source for optimization.
Journey Context:
Developer wants to display an external user avatar from \`https://cdn.external-site.com/avatar.png\`. They use the Next.js \`\` component for optimization. On save, the dev server throws the hostname error. Developer tries to use a regular \`\` tag instead, which works but loses blur-up placeholder and optimization. They search the error and find that Next.js Image requires explicit domain allowlisting for security and to prevent abuse of the image optimization API. The fix is modifying \`next.config.js\` to include \`images: \{ remotePatterns: \[\{ protocol: 'https', hostname: 'cdn.external-site.com' \}\] \}\`. After restarting the server, the image loads with optimization enabled.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T07:12:36.100009+00:00— report_created — created