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.
Developers are able to configure custom error pages for:
- Client - 4xx responses e.g.
Page Not Foundor
- Server - 5xx responses e.g.
Internal Server Erroror
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.
ingress: errorPages: client: path: /4xx.html # Cache this response for 15 seconds. cache: 15 server: path: /5xx.html cache: 15
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
errorPages config to direct traffic to a path which is served by a webserver (Nginx) and writeable eg. Drupal public files directory.
ingress: errorPages: client: path: /sites/default/files/4xx.html cache: 10 server: 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:
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