Skip to content

Error Pages

AWS CloudFront provides very basic error pages which don't represent the application which they are serving.

Skpr provides development teams with the ability to deploy custom pages for both client and server errors.

Basic Usage

Developers are able to configure custom error pages for:

  • Client - 4xx responses e.g. Page Not Found or Access Denied.
  • Server - 5xx responses e.g. Internal Server Error or Service Unavailable.

Custom error pages will be cached by a user defined period of time (see below). Caching error pages can help in high traffic scenarios and avoid stampeding.

      path:  /4xx.html
      # Cache this response for 15 seconds.
      cache: 15
      path:  /5xx.html
      cache: 15

Advanced Usage

Maintenance Page for Drupal

This approach allows developers to provide a different error response while a deployment is occuring eg. Site is being updated. Check back soon.

Error pages configuration

Update the errorPages config to direct traffic to a path which is served by a webserver (Nginx) and writeable eg. Drupal public files directory.

      path: /sites/default/files/4xx.html
      cache: 10
      path: /sites/default/files/5xx.html
      cache: 10

Use exec during deploymenst to switch the files

The files can then be updated before and after the deployment to allow for a custom maintenance page during 5xx and 4xx application error responses.

Files required for this approach:

  • 5xx.html
  • 4xx.html
  • maintenance.html

Example showing skpr exec commands:

# Update files to serve the maintenance page.
skpr exec ENVIRONMENT -- ln -sf /data/maintenance.html /data/app/sites/default/files/5xx.html
skpr exec ENVIRONMENT -- ln -sf /data/maintenance.html /data/app/sites/default/files/4xx.html

# Deploy the site, enable Drupal maintenance mode.

# Update files to serve the standard error pages.
skpr exec ENVIRONMENT -- ln -sf /data/5xx.html /data/app/sites/default/files/5xx.html
skpr exec ENVIRONMENT -- ln -sf /data/4xx.html /data/app/sites/default/files/4xx.html