Redirect from IP to domain

12/13/2019

How can redirect page from IP to domain name my.page.com? Everything works when I open page via my.page.com. When I open via IP I get incorrect certificate "CN = Kubernetes Ingress Controller Fake Certificate O = Acme Co". I want only to redirect people from IP to 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: - hosts: - my.page.com secretName: tls-secret rules: - host: my.page.com http: paths: - path: /api backend: serviceName: api servicePort: 8090 - path: / backend: serviceName: app servicePort: 8080

I installed Ingress from here

-- wolacinio
kubernetes
kubernetes-ingress
nginx-ingress

1 Answer

12/16/2019

There is a good documentation with examples on topic.

Generally there are 2 ways to proceed:

  • modyfying the Nginx config and adding rewrite rules there. For that you need to pass new parts of config through the snippets.

  • use ingress controller like Traefik. Traefic allows you to match specific patter in URL and rewrite it on the fly.

Hope that helps.

-- Nick
Source: StackOverflow