You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One of your pages that leverages the `next/image` component, passed a `src` value that uses a hostname in the URL that isn't defined in the `images.remotePatterns` in `next.config.js`.
8
8
9
+
Each part of the `src` value is strictly matched against your `images.remotePatterns` definitions. Matching is exact and case-sensitive, meaning a mismatch in any single part will fail the check.
10
+
11
+
For a URL like `https://example.org/images/example?v=1234`, the following parts must match the pattern you configured:
12
+
13
+
-**Protocol**: `http` vs `https` must match exactly.
14
+
-**Hostname**: `example.org` is different from `www.example.org` and from subdomains like `assets.example.org`.
15
+
-**Port**: If present (e.g. `:3000`), it must be included.
16
+
-**Pathname**: The path must be covered by your glob, e.g. `/**` or `/images/**`.
17
+
-**Search**: If specified in a pattern, it must match the full search string exactly (including the leading `?`). Globs are not supported for search.
18
+
19
+
If any of these differ from the actual `src`, the image will be rejected.
20
+
21
+
Common pitfalls that cause this error:
22
+
23
+
- Using `https` in `src` but only allowing `http` (or vice‑versa).
24
+
- Loading from a subdomain like `assets.example.com` while only configuring `example.com`.
25
+
- Missing a port during local/dev usage, e.g. `http://localhost:3000`.
26
+
- A too‑narrow pathname pattern (e.g. `/images/` instead of `/images/**`).
27
+
- When using the `URL` constructor, if no `search` is specified, then the `search` property is set to an empty string `''`, which means search params are **NOT** allowed.
28
+
29
+
See the [Remote Patterns](/docs/pages/api-reference/components/image#remotepatterns) reference for details.
30
+
9
31
## Possible Ways to Fix It
10
32
11
33
Add the protocol, hostname, port, and pathname to the `images.remotePatterns` config in `next.config.js`:
0 commit comments