Features not supported with output: export (headers, redirects, image loader) Next.js Origin: On your device OSI layer 7 · Application Last updated 5 Nov 2026

Next.js: Specified "headers" cannot be used with "output: export" / Image Optimization using the default loader is not compatible with `{ output: 'export' }`

Static export (output: 'export') can't use server features like rewrites/headers/redirects, default image optimisation, middleware or dynamic APIs.

Exact message you may see Specified "headers" cannot be used with "output: export"Image Optimization using the default loader is not compatible with `{ output: 'export' }`Specified "redirects" cannot be used with "output: export"Specified "rewrites" cannot be used with "output: export"Middleware cannot be used with "output: export"
Seen on: Next.js

Meaning

Use images: { unoptimized: true } (or a custom loader), configure headers/redirects at the host (Netlify _headers, Nginx), remove middleware/route handlers that need a server, and avoid cookies()/headers(). Or deploy as a normal Node/Vercel app instead of export.

Common causes

  • next/image default loader with export
  • headers/redirects/rewrites in next.config
  • Middleware or API routes present
  • Server Actions or dynamic APIs
  • ISR/revalidate expectations

⚡ Quick fix

  1. images: { unoptimized: true }
  2. Move headers/redirects to the hosting layer
  3. Remove server-only features or drop output: "export"

Detailed fix by platform

Next.js

  1. module.exports = { output: "export", images: { unoptimized: true } };

How to diagnose

  1. Feature — Which unsupported?
  2. Hosting — Static only?
  3. Alternative — Server deploy?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Conflicting app and page file was found — Next.js: ⨯ Conflicting app and page file was found, please remove the conflicting files to continue: "pages/index.tsx" - "app/page.tsx" (Next.js)Conflicting app and p…Invalid next.config.js options detected — Next.js: Invalid next.config.js options detected: Unrecognized key(s) in object: 'xyz' (Next.js)Invalid next.config.j…next build: fetch failed ECONNREFUSED (build-time API) — Next.js: Error occurred prerendering page "/blog" TypeError: fetch failed { cause: Error: connect ECONNREFUSED 127.0.0.1:3000 } (Next.js)next build: fetch fai…next build: JavaScript heap out of memory — Next.js: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory (during next build) (Next.js)next build: JavaScrip…next.config.js: ES Module / require error — Next.js: Error [ERR_REQUIRE_ESM]: require() of ES Module next.config.js / SyntaxError: Unexpected token 'export' (Next.js)next.config.js: ES Mo…next/image hostname — Error: Invalid src prop on `next/image`, hostname "x" is not configured under images in your `next.config.js` (React)next/image hostnamePage is missing generateStaticParams() (output: export) — Next.js: Page "/blog/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config (Next.js)Page is missing gener…Features …

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.