Score:0

Kubernetes NGINX Ingress controller default page / redirect

cn flag

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))

Score:0
za flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.