Hi All,
Have been playing with Tyk Community Edition Gateway for quite some time. I’d quickly get to my query.
Q: I’d like to inject a correlation id to all requests (to proxy/upstream) and to responses (back to originating client) to track request-responses end to end.
What I’ve done so far:
- Set global headers for the proxy/upstream:
"global_headers": {
"X-Request-Id": "$tyk_context.request_id"
}
- Set transform_response_headers
"transform_response_headers": [
{
"add_headers": {"X-Request-Id": "$tyk_context.request_id"},
"path": "(.*)",
"method": "POST"
}
This perfectly works, but I’ve some queries:
- Is there an easier way to do this?
- Are the
global_headers
only to the upstream and applied only on request? Won’t it work on responses? - Can the
transform_response_headers
support any HTTP method without explicitly mentioning it? Else, do I have to add more array items for GET, PUT, DELETE etc.?
Thank you for all the support in advance.
Regards,
Sreekanth