Next.js Discord

Discord Forum

500 error page cached on CDN causes the page to cache forever

It seems that nextjs sets cache-control header to s-maxage=31536000, stale-while-revalidate
for a 500 response.

The issue is we are using Cloudfront CDN in front of the next server so whenever there is a 500 error, the page got cached for ever.

Is there any way I can either make the 500 error page render dynamically? Or anything can be done here?

0 Replies