Reputation: 138
How can I redirect a page from an IP address to domain name my.page.com? Everything works when I open the page via my.page.com. When I open via the IP address I get "incorrect certificate "CN = Kubernetes Ingress Controller Fake Certificate O = Acme Co".
I want only to redirect people from an IP address to a domain.
`apiVersion: extensions/v1beta1 kind: Ingress metadata: name: web-ingress annotations: kubernetes.io/ingress.allow-http: "false" nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" spec: tls:
I installed Ingress from here.
Upvotes: 0
Views: 1532
Reputation: 1948
There is good documentation with examples on topic.
Generally there are two ways to proceed:
modifying the Nginx configuration and adding rewrite rules there. For that, you need to pass new parts of the configuration through the snippets.
use an ingress controller like Træfik. Træfik allows you to match specific patter in URL and rewrite it on the fly.
Upvotes: 0
Reputation: 536
Create a deployment that gives a 404 or nginx 404.html page which do redirect to the main domain.
Then In Ingress deployment pass that service as the default service --default-backend-service=<namespace>/<service>
Which mean, when none of the rules match with the ingress file, then the default service will take that request.
In your case, the IP address would be showing an nginx page that 'page not found', if the default service was not set.
Read here: Default backend
Upvotes: 0