Skip to content

This repo creates a docker image containing custom HTTP error page for service on the Cloud Platform that don't want to use the default-backend provided by nginx.

License

Notifications You must be signed in to change notification settings

ministryofjustice/cloud-platform-custom-error-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloud Platform Custom Error Pages

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.

Usage

  1. Create your custom HTTP error pages in the rootfs/www folder, following the existing code.format pattern.
  2. Edit the makefile and change the version number of the IMAGE line near the top of the file.
  3. Run make all to create a new version of the docker image, with your custom error pages.
  4. Run make push to tag and push the image to docker hub.
  5. Use run.sh to run the image locally, and call.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.

Installation in a Kubernetes cluster

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

About

This repo creates a docker image containing custom HTTP error page for service on the Cloud Platform that don't want to use the default-backend provided by nginx.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published