This repo creates a docker image containing custom HTTP error pages, to be used as per these instructions.
A default-backend is served by nginx as a fall-back. This is typically when the sub-domain, for example https://wrongdomain.cloud-platform.service.justice.gov.uk/
, isn't recognized. Otherwise, the default nginx page would show, which doesn't look professional.
This is a simplified version of the kubernetes/ingress-nginx example.
- Create your custom HTTP error pages in the
rootfs/www
folder, following the existingcode
.format
pattern. - Edit the
makefile
and change the version number of theIMAGE
line near the top of the file. - Run
make all
to create a new version of the docker image, with your custom error pages. - Run
make push
to tag and push the image to docker hub. - Use
run.sh
to run the image locally, andcall.sh
to send http requests for the different error pages.
NB: This image can only respond with a single HTML file. So, if you want your custom error page to use other assets such as images, fonts, stylesheets, etc. you need to ensure that those are available at some fixed URLs, and hard-code those URLs into your error pages.
Update the defaultBackend config in the nginx-ingress-acme.tf, with the docker image created above containing custom HTTP error pages.
defaultBackend:
enabled: true
name: default-backend
image:
repository: ministryofjustice/cloud-platform-custom-error-pages
tag: "0.3"
pullPolicy: IfNotPresent
extraArgs: {}
port: 8080