k8s: make www canonical; 301 the apex to www
Adds a Traefik redirectRegex middleware and a dedicated apex ingress that reuses bluecap-website-tls, and drops the apex from the main ingress rules.
This commit is contained in:
1 parent
d1c1726796
commit
da1043e6f3
1 file changed
+35
-13
+35
-13
@@ -4,17 +4,11 @@
|
|||||||
# 10.66.15.30) with a real Let's Encrypt cert. This is how the rebuild is reviewed before
|
# 10.66.15.30) with a real Let's Encrypt cert. This is how the rebuild is reviewed before
|
||||||
# launch. Safe: it is not reachable from the internet and does not touch the real domain.
|
# launch. Safe: it is not reachable from the internet and does not touch the real domain.
|
||||||
#
|
#
|
||||||
# 2. www.bluecapstrategies.com / bluecapstrategies.com — PRODUCTION. Listed as routes so the
|
# 2. www.bluecapstrategies.com — PRODUCTION (live since 2026-10-23, via Pangolin). The apex
|
||||||
# cluster is ready, but deliberately NOT in the tls block yet: the live WordPress site still
|
# bluecapstrategies.com only 301s to www (separate ingress at the bottom of this file).
|
||||||
# serves these names and must keep doing so until cutover. Requesting a cert for them is a
|
|
||||||
# launch step, not a prerequisite.
|
|
||||||
#
|
#
|
||||||
# TLS: ClusterIssuer is `letsencrypt-prod` (NOTE: not "letsencrypt-production" — an earlier comment
|
# TLS: ClusterIssuer is `letsencrypt-prod` (NOTE: not "letsencrypt-production"). It solves via
|
||||||
# here had the name wrong). It solves via DNS-01 against Cloudflare, which means a cert can be
|
# DNS-01 against Cloudflare, so certs for these names issue independently of where DNS points.
|
||||||
# issued BEFORE any DNS points at this cluster. At cutover, add the two production hosts to the
|
|
||||||
# tls block and let the cert issue first, then move DNS — no insecure window, no HTTP-01
|
|
||||||
# chicken-and-egg. That requires bluecapstrategies.com to be in the Cloudflare account the
|
|
||||||
# cert-manager API token can reach; verify that before relying on it.
|
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
@@ -38,9 +32,9 @@ spec:
|
|||||||
# CANNOT be pre-issued; it is obtained on the first request after DNS moves. See
|
# CANNOT be pre-issued; it is obtained on the first request after DNS moves. See
|
||||||
# docs/launch-checklist.md section 1.1.
|
# docs/launch-checklist.md section 1.1.
|
||||||
#
|
#
|
||||||
# Both names are listed because the canonical-host decision (section 1.6) is still open;
|
# Both names stay on this one cert. www is canonical; the apex is served by the
|
||||||
# holding a cert for each keeps either choice available. The redirect is configured
|
# redirect ingress below, which reuses this secret (no cert-manager annotation there, so
|
||||||
# separately and does not depend on this.
|
# the two ingresses never compete over the Certificate).
|
||||||
- hosts:
|
- hosts:
|
||||||
- www.bluecapstrategies.com
|
- www.bluecapstrategies.com
|
||||||
- bluecapstrategies.com
|
- bluecapstrategies.com
|
||||||
@@ -66,6 +60,34 @@ spec:
|
|||||||
name: bluecap-website
|
name: bluecap-website
|
||||||
port:
|
port:
|
||||||
name: http
|
name: http
|
||||||
|
---
|
||||||
|
# Canonical host is www (2026-10-23). The apex answers only with a permanent redirect to the
|
||||||
|
# same path on www, so search engines consolidate on one host.
|
||||||
|
apiVersion: traefik.io/v1alpha1
|
||||||
|
kind: Middleware
|
||||||
|
metadata:
|
||||||
|
name: redirect-apex-to-www
|
||||||
|
namespace: bluecap-strategies
|
||||||
|
spec:
|
||||||
|
redirectRegex:
|
||||||
|
regex: ^https?://bluecapstrategies\.com/(.*)
|
||||||
|
replacement: https://www.bluecapstrategies.com/${1}
|
||||||
|
permanent: true
|
||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: bluecap-website-apex-redirect
|
||||||
|
namespace: bluecap-strategies
|
||||||
|
annotations:
|
||||||
|
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
||||||
|
traefik.ingress.kubernetes.io/router.middlewares: bluecap-strategies-redirect-apex-to-www@kubernetescrd
|
||||||
|
spec:
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- bluecapstrategies.com
|
||||||
|
secretName: bluecap-website-tls
|
||||||
|
rules:
|
||||||
- host: bluecapstrategies.com
|
- host: bluecapstrategies.com
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
|
|||||||
Reference in new issue
Block a user