Home > Mobile >  Is there a way to customize the Heroku internal server error page?
Is there a way to customize the Heroku internal server error page?

Time:09-29

So, Heroku has some very limited documentation on how to customize error pages but I haven’t found documentation on how to modify the internal server error page. I would like to show a custom page so users at least get some guidance on why their query did not work properly. The internal server error is extremely ambiguous.

Here is an example of what the internal server error page currently looks like on my Heroku app… enter image description here

CodePudding user response:

The pages displayed to your users when the application encounters a system error or is placed in the maintenance state can be customized. Customizing these pages allows you to present a more consistent UI to your users.

Create and store the custom pages

Create your custom pages as static HTML. You may wish to use the default HTML served by Heroku as a template:

https://www.herokucdn.com/error-pages/application-error.html
https://www.herokucdn.com/error-pages/no-such-app.html
https://www.herokucdn.com/error-pages/maintenance-mode.html
https://www.herokucdn.com/error-pages/ssl-cert-error.html

You can reference images or CSS from the HTML as long as you use relative paths (for example, ) and you upload the other assets into the same place as the HTML.

You can host the pages anywhere that can serve web pages. It recommends uploading to Amazon S3. If you use S3, don’t forget to set the HTML and all assets to be publicly readable.

Configure your application

Set the ERROR_PAGE_URL and MAINTENANCE_PAGE_URL config vars to the publicly accessible URLs of your custom pages:

heroku config:set \
ERROR_PAGE_URL=//s3.amazonaws.com/<your_bucket>/your_error_page.html \
MAINTENANCE_PAGE_URL=//s3.amazonaws.com/<your_bucket>/your_maintenance_page.html

Refer this page : https://devcenter.heroku.com/articles/error-pages

CodePudding user response:

Instead of trying to make a custom page for my first issue, I used programming logic to give user errors to preempt problems related to Heroku's Internal Server Error page when my application did not run appropriately. I highly suggest you think deeply before employing this method, as it could confuse users. The Heroku Internal Server Error page is an either-or reason code. While you know (as the programmer) only one reason code applies, since you've preempted the problem with logic, the user won't assume that. For me, it was better than the alternative - which was to leave it completely ambiguous. At least, I can give users some feedback.

  • Related