Vercel logo

Custom Error Pages with Public Directory

This example demonstrates how to create custom error pages using static HTML files in the public directory. Replace Vercel's default platform error pages with your own branded experience for errors like function timeouts or throttling.

How it works:

  • Add static HTML files at public/500.html and public/504.html
  • Vercel automatically detects and serves these for platform errors
  • The 500 page acts as a fallback for all unhandled error codes

Template tokens:

  • ::vercel:REQUEST_ID:: - Unique request identifier
  • ::vercel:ERROR_CODE:: - Error type (e.g., FUNCTION_INVOCATION_TIMEOUT)

Try it out:

Click "Trigger Timeout" to trigger a function timeout and see the custom error page in action. The page is configured to timeout after 3 seconds.