Is there a way to disable nginx-ingress-controller default backend and use a static page for errors (4xx & 5xx)?

12/13/2019

Let's say I want to disable the default backend of nginx-controller and just serve an static page for errors. Is that possible? I've tried mounting the page in the pod filesystem and add this to the nginx-controller configmap (using helm):

server-snippet: |
      error_page 404 500 501 502 503 504 505 506 507 508 510 511 /error.html;
      location = /error.html {
       internal;
       root /var/www/default;
      }

But that does not work, even though I've managed to get the error.html file in /var/www/defalut. I would appreciate any comment that can point me out in the right direction.
The other workaround for this is building a custom Deafult Backend but that is overkill to just serve a static web page.

-- eduartua
kubernetes
nginx-ingress

0 Answers