Compare commits

...

3 Commits

Author SHA1 Message Date
Unchained 1ed6cac647 fix(k8s): use NodePort with externalTrafficPolicy Local to preserve client IP
Build and Deploy / build (push) Has been cancelled
Change storefront service from ClusterIP to NodePort with externalTrafficPolicy: Local.
This preserves the real client source IP instead of NATing to the node IP.

Fixes analytics tracking showing Hetzner IP (138.201.11.251) instead of real visitor IPs.
Same fix previously applied to Rybbit backend service.

Note: On single-node clusters, this works seamlessly. Traefik routes directly
to the node where the pod is running, preserving the original source IP.
2026-04-03 06:55:42 +02:00
Unchained e476bc9fc4 fix(k8s): add HTTP to HTTPS redirect for manoonoils.com
Build and Deploy / build (push) Has been cancelled
- Create redirect-https middleware for permanent redirect (301)
- Split IngressRoute: HTTP route redirects to HTTPS, HTTPS route serves app
- Fixes Google Search Console 404 error on HTTP version
- No application code changes, only routing configuration
2026-04-02 22:50:43 +02:00
Unchained 9124eeedc1 fix: add ts-ignore for request.ip runtime property
Build and Deploy / build (push) Has been cancelled
2026-04-01 10:47:09 +02:00
5 changed files with 40 additions and 9 deletions
+18 -2
View File
@@ -6,10 +6,26 @@ metadata:
spec:
entryPoints:
- web
routes:
- kind: Rule
match: Host(`manoonoils.com`) || Host(`www.manoonoils.com`)
middlewares:
- name: redirect-https
services:
- name: storefront
port: 3000
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: storefront-secure
namespace: manoonoils
spec:
entryPoints:
- websecure
routes:
- match: Host(`manoonoils.com`) || Host(`www.manoonoils.com`)
kind: Rule
- kind: Rule
match: Host(`manoonoils.com`) || Host(`www.manoonoils.com`)
services:
- name: storefront
port: 3000
+1
View File
@@ -3,6 +3,7 @@ kind: Kustomization
resources:
- deployment.yaml
- service.yaml
- middleware.yaml
- ingress.yaml
images:
- name: ghcr.io/unchainedio/manoon-headless
+9
View File
@@ -0,0 +1,9 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: redirect-https
namespace: manoonoils
spec:
redirectScheme:
scheme: https
permanent: true
+5 -1
View File
@@ -4,9 +4,13 @@ metadata:
name: storefront
namespace: manoonoils
spec:
# Use NodePort with externalTrafficPolicy: Local to preserve client source IP
# This is required for proper client IP detection in analytics (Rybbit, etc.)
type: NodePort
externalTrafficPolicy: Local
selector:
app: storefront
ports:
- port: 3000
targetPort: 3000
type: ClusterIP
# Let Kubernetes assign a NodePort automatically
+2 -1
View File
@@ -10,7 +10,8 @@ export async function POST(request: NextRequest) {
const cfConnectingIp = request.headers.get("cf-connecting-ip");
const xForwardedFor = request.headers.get("x-forwarded-for");
const xRealIp = request.headers.get("x-real-ip");
const nextJsIp = request.ip;
// @ts-ignore - ip exists at runtime but not in types
const nextJsIp = (request as any).ip;
// Use the first available IP in priority order
const clientIp =