Simple domain redirect in Kubernetes with nginx ingress
You want to establish a redirect from an old domain of a client to their new domain but the certificate should remain the same, supporting all URI arguments
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: old-domain-redirect
namespace: my-namespace
annotations:
cert-manager.io/cluster-issuer: letsencrypt
nginx.ingress.kubernetes.io/permanent-redirect: https://new-domain.com$request_uri
nginx.ingress.kubernetes.io/ssl-redirect: 'true'
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: old-domain.com
tls:
- hosts:
- old-domain.com
secretName: old-domain.com-cert
Issue:
You want to establish a redirect from an old domain of a client to their new domain but the certificate should remain the same, supporting all URI arguments
Prerequisites:
This only works for kubernetes / K8S and nginx ingress based infrastructure environments.
Solution:
Use the snippet provided.
Ihre Drupal-Website zukunftssicher machen
Wir prüfen Ihr System und zeigen, was Sie für AI, Wartung und Upgrades brauchen.