Created
April 6, 2021 09:31
-
-
Save lemonlatte/5f9981072887f8363d905c3ab5f04e5c to your computer and use it in GitHub Desktop.
ingress nginx www redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: networking.k8s.io/v1beta1 | |
kind: Ingress | |
metadata: | |
annotations: | |
kubernetes.io/ingress.class: nginx | |
nginx.ingress.kubernetes.io/configuration-snippet: | | |
if ($host = "www.example.com") { | |
return 308 https://example.com$request_uri; | |
} | |
name: example-www | |
namespace: example | |
spec: | |
rules: | |
- host: www.example.com | |
tls: | |
- secretName: example-www-tls | |
--- | |
apiVersion: cert-manager.io/v1alpha3 | |
kind: Certificate | |
metadata: | |
name: example-www | |
namespace: example | |
spec: | |
commonName: www.example.com | |
dnsNames: | |
- www.example.com | |
issuerRef: | |
kind: ClusterIssuer | |
name: letsencrypt | |
secretName: example-www-tls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment