I’d like to enable tracing in our Tyk Gateway but need to prevent the X-Tyk-Trace-ID header from appearing in responses to clients.
I’ve tried using global_headers_remove, transform_headers, and custom plugins, but the header still appears in responses.
Is there a way to keep tracing enabled for our monitoring needs while hiding this specific header from clients?
Isaac
2
Hi Roni,
Thanks for reaching out and detailing your attempts to remove the X-Tyk-Trace-ID
header.
Just to clarify:
transform_headers
only modifies request headers to upstream services.
- To remove response headers (like
X-Tyk-Trace-ID
), use transform_response_headers
in your API definition.
Example:
"extended_paths": {
"transform_response_headers": [
{
"delete_headers": ["X-Tyk-Trace-ID"],
"path": "{all}",
"method": "ALL"
}
]
}
This will strip the header from all client-facing responses while keeping tracing active.
For more information you can check Transform Traffic by using Tyk Middlewares
Alternatively, you can also place a reverse proxy (e.g., NGINX or HAProxy) in front of Tyk to remove this header from responses if preferred.
Regards
Isaac