Skip to content

fix(analytics): record real client IP behind nginx ingress#81

Merged
judedanbo merged 1 commit into
mainfrom
claude/analytics-ip-address-nginx-pm5l7q
Jun 16, 2026
Merged

fix(analytics): record real client IP behind nginx ingress#81
judedanbo merged 1 commit into
mainfrom
claude/analytics-ip-address-nginx-pm5l7q

Conversation

@judedanbo

Copy link
Copy Markdown
Owner

Web Analytics recorded cluster-internal ingress-nginx pod IPs because
ANALYTICS_TRUSTED_PROXIES was never set, so extractClientIp() ignored
X-Forwarded-For and used the socket peer.

  • Set NUXT_ANALYTICS_TRUSTED_PROXIES (private ranges) in the k8s base
    configmap so the app honors X-Forwarded-For from the in-cluster proxy.
    NUXT_-prefixed so it overrides runtimeConfig at runtime.
  • getAnalyticsConfig() now coerces trustedProxies from a comma-string as
    well as an array, so the runtime NUXT_ override (which arrives as a
    string) is not silently dropped to [].
  • Add regression test for the coercion.
  • Document the NUXT_ prefix requirement and ingress externalTrafficPolicy
    caveat in the production checklist and .env.example.

https://claude.ai/code/session_01VovHZ6DxypcGAFDmpRzKH3

Web Analytics recorded cluster-internal ingress-nginx pod IPs because
ANALYTICS_TRUSTED_PROXIES was never set, so extractClientIp() ignored
X-Forwarded-For and used the socket peer.

- Set NUXT_ANALYTICS_TRUSTED_PROXIES (private ranges) in the k8s base
  configmap so the app honors X-Forwarded-For from the in-cluster proxy.
  NUXT_-prefixed so it overrides runtimeConfig at runtime.
- getAnalyticsConfig() now coerces trustedProxies from a comma-string as
  well as an array, so the runtime NUXT_ override (which arrives as a
  string) is not silently dropped to [].
- Add regression test for the coercion.
- Document the NUXT_ prefix requirement and ingress externalTrafficPolicy
  caveat in the production checklist and .env.example.

https://claude.ai/code/session_01VovHZ6DxypcGAFDmpRzKH3
@judedanbo judedanbo merged commit 8421675 into main Jun 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants