'Don't serve error pages on Rails production

Is there a simple way to tell Rails (6) not to serve error pages (404/422/500) on production?

I have all the static assets served by the reverse proxy and I'd like to serve such error pages also from there.

The proxy is configured as follows

 error_page 404 /404.html;
 location = /404.html {
   root /usr/share/nginx/html;
   internal;
 }

With this configuration, the 404 rendered page is the one in the public directory within the Rails app and not the one at /usr/share/nginx/html.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source