Custom Error Message if Collabora server is down

I have an COLLABORA server running in one machine and NGINX proxy on another. I have a valid configuration for NGINX redirecting the requests to the COLLABORA server.
I would like to show a custom message in case of the COLLABORA server being offline. I tried using error_page … line in the NGINX config and it works when I try it from the browser but in NEXTCLOUD still I see the “Internal Error” blue page instead.