Go agent high_security mode X-NewRelic-Id forwarding with X-Forwarded-For proxy trust
0 reputation · 03 Nov 2022, 23:48 UTC
0 reputation · 03 Nov 2022, 23:48 UTC
Distributed trace correlation in New Relic relies on the Go agent propagating X-NewRelic-Id across service boundaries. In high_security mode the agent applies additional header filtering, and the interaction with X-Forwarded-For from proxy chains defines a configuration boundary for correlation.
The desired behavior is consistent trace propagation when requests pass through a proxy chain while high_security remains enabled. The interaction between high_security header filtering and proxy trust flags is not clearly specified for agent versions around 8.5 to 9.2, where header filter logic was refactored to prioritize proxy trust.
What proxy trust configuration is required for X-NewRelic-Id to be forwarded when X-Forwarded-For is present? Does high_security mode suppress the header independently of the proxy trust list? Which agent versions exhibit header suppression under untrusted proxy conditions?
33275 reputation · 04 Nov 2022, 00:02 UTC
High security mode does not suppress outbound forwarding of X-NewRelic-Id. What it tightens is inbound acceptance of trace and forwarding headers. When X-Forwarded-For arrives from a proxy the agent does not trust, the agent treats the forwarded headers as untrusted and drops inbound trace linkage — which looks like broken distributed trace correlation even though the header is still being injected downstream.
Confirmed (well-established): New Relic's high security mode restricts inbound header collection and distributed trace context extraction. Outbound injection of trace headers for correlation is retained; inbound acceptance is gated. Separately, use of X-Forwarded-For for client identity and trace linkage is gated by proxy trust.
Likely explanation for your symptom: your proxy chain is not in the agent's trust configuration, so inbound trace context from X-NewRelic-Id is discarded at the receiving service. Correlation breaks at the trust boundary, not at injection time.
The agent on the receiving service must be configured to trust the proxy chain that sets X-Forwarded-For. In practice this means:
X-Forwarded-For and the accompanying trace headers instead of treating them as client-spoofable input.Exact key names vary by agent version and deployment method (config file vs. environment variables), so map these generic names to your version's documentation rather than copying keys blindly.
Header filter logic was refactored in roughly the 8.5–9.2 range to prioritize proxy trust checks. The practical effect: suppression of inbound trace context under untrusted proxy conditions became more consistent, making proxy trust a hard prerequisite for correlation. If you upgraded into or within this range and correlation broke at the same time, the trust check is the first thing to verify. Treat the exact version boundaries as uncertain until checked against your agent's changelog.
X-NewRelic-Id actually arrives.Note: high security also disables custom attributes and some header collection, which can hide the diagnostic signals above — debug logging at the agent level is the most reliable observation point.
Which direction is failing for you — inbound linkage at the receiving service, or the header missing on the wire entirely? If a packet capture shows X-NewRelic-Id never leaves the upstream service, the problem is injection-side and this analysis needs revisiting.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.