Create Custom Error Pages
This document explains how to make custom error pages for web pages. Native mobile does not use custom error pages, as users cannot enter URLs which lead to them.
To create customized error information for native pages, please create custom system texts.
Introduction
Whenever your application is stopped, you are presented with the default Mendix error page. However, you can make a custom error page on Mendix Cloud for a more tailored user experience.
Specifically, you can create an offline.html
page, a 404.html
page, and a 403.html
page.
The different files serve different purposes:
offline.html
: will be served when your application has been stopped manually404.html
: will be served whenever a path does not exist403.html
: will be served when access to a resource is denied, because an IP filter has been implemented or because of client certificate restrictions
If you do not create these files, the default error page will be used for each scenario:
This how-to teaches you how to do the following:
- Create a custom error page
Prerequisites
Before starting this how-to, make sure you have completed the following prerequisites:
- Have a local repository of the app
- Have your app hosted in Mendix Cloud
- Identify which version of the Atlas module you are using
Creating a Custom Error Page
If you are using Atlas 3, do the following:
-
Open the local folder of your app.
-
Go to theme:
-
Go to web:
-
Create a new folder named error_page:
-
In the error_page folder, place your offline.html file:
Optionally, you can also create 404.html and 403.html pages.
In these .html files, you can only refer to external resources or resources under the absolute path/error_page/
; the/error_page/
path is the only one that will be available when the application is stopped. -
Commit the changes in Studio Pro.
Example Offline Page
An example offline.html
, 404.html
, or 403.html
page could look like this:
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/error_page/style.css">
<script src="/error_page/script.js"></script>
</head>
<body>
This application is currently offline.
</body>
</html>
This example refers to style.css and script.js, which you should also create and place in the error_page directory if you want to have special styling and/or JavaScript.