0

I was wondering if there is a way to change the behaviour of the nginx ingress controller so that instead of a 404 page it displays another web page or does a redirect? Sadly you can’t do

  • host: “*”

To achieve the same thing since its not a valid subdomain definition.

Any help is much appreciated!

(Using the ingress controller from here: k8s.gcr.io/ingress-nginx/controller (Docker Image))

1 Answers1

0

Well, in a non-microservice world when you use nginx you have an option to land all of the HTTP requests on a host with a default listen flavor. Since the ingress controller in a k8s environment is basically still an nginx server with some additional functionality, you can do the same thing, but this time you'll have to customize the controller deployed.

See, the out-of-the-box controller still has this default functionality, and it's this very thing that provides the 404 page you're seeing. It's even explained in the official documentation.

There's a poorly documented approach described here, but I'd go with cloning and customizing the upstream itself.

drookie
  • 8,625
  • 1
  • 19
  • 29