Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
Create custom 5xx error pages using Next.js App Router

Astro landing page starter with gradient background, responsive hamburger/dropdown menu, and switchable floating/fullscreen headers.
Custom Error Pages (App Router) is a Vercel example template that shows how to create custom 5xx server-error pages for a Next.js application using the App Router, with routes automatically generated and served from Vercel's CDN.
This is a Next.js example from the vercel/examples repository that demonstrates how to build custom error pages for 5xx server errors. It takes a Next.js App Router project structure and adds two route pages: app/500/page.tsx for a generic server error fallback and app/504/page.tsx for a specific gateway timeout page. When deployed to Vercel, these routes are automatically detected and mapped to the corresponding HTTP error codes, so users see your branded error page instead of Vercel's default one. The template is built with Next.js and styled with Tailwind CSS, and is meant to be cloned and customized.
When deployed to Vercel, the platform automatically scans for app/500/page.tsx and app/504/page.tsx in the Next.js project. It then maps HTTP error codes to those routes: a 500 error serves /500, 502, 503, and 508 fall back to /500, and 504 serves /504. The mapping table in the README documents this behavior, and the live demo URL verifies the rendered output.
The custom error pages feature is part of Vercel's Enterprise plan; it is not available on the free, hobby, or pro tiers. The example code itself is open source and free to clone, modify, and deploy, but serving these pages through Vercel's automatic error-route generation requires an Enterprise subscription.
The feature is available only to Enterprise customers. If you are on a free, hobby, or pro plan, Vercel will serve its default error pages even if you add the custom route files.
The template demonstrates customization for 500 and 504. Vercel's automatic detection also handles 502, 503, and 508, and any other 5xx code falls back to the 500 page you define.
Yes, you can clone the repository with create-next-app and run it locally with pnpm dev. However, the automatic error-route generation happens only when the app is deployed to Vercel on an Enterprise plan.
You can click the "Deploy with Vercel" button in the README, which opens a pre-filled new project page on Vercel, or clone the repo and run pnpm dev locally before deploying.
No, the example focuses exclusively on 5xx server errors. For client-side not-found handling, you would use Next.js's app/not-found.tsx route separately.
