How can I redirect from the Netlify 502 error screen?


I sometimes have lamda function timeouts because my underlying services are unavailable. When this happens, I get the Netlify 502 “This function has crashed” screen.

I would rather be able to display an error screen within my own app when this happens, so that I can message users appropriately, but I can’t seem to figure out how to write a redirect that does this.

My netlify site ID is c60bdab6-8b64-48a1-9376-7cd55ed8329f
My custom domain is
I would like to be able to display a page at when my services are unavailable.

I appreciate any pointers you can provide, thank you.

  • Joe

You can set a custom 404 page here:

I’m not sure if that will work for a custom 502 page, but you can try. You could also use an edge function: edge-functions-examples/pages/rewrite at main · netlify/edge-functions-examples · GitHub

I have a custom 404, but it doesn’t catch the 502 that currently goes to the Netlify lamda function timeout screen. I’ll see about doing a spike with the edge function as you mention, perhaps that would let me intercept the 502 and handle it accordingly. Thanks.