Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a user I should be able to add correlation IDs to all my requests #713

Closed
lonelycode opened this issue May 2, 2017 · 9 comments
Closed

Comments

@lonelycode
Copy link
Member

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
All requests coming through the gateway are not uniquely identified

What is the expected behavior?
Tyk should tag up each request with a correlation ID (UUID), that can be injected as a header using the tyk_context namespace

Which versions of Tyk affected by this issue? Did this work in previous versions of Tyk?
All

@lonelycode lonelycode added this to the Release 2.4 milestone May 2, 2017
@lonelycode lonelycode self-assigned this May 2, 2017
@mvdan
Copy link
Contributor

mvdan commented May 2, 2017

Would this be the same thing as a "request ID"?

Would this be used by us, by users, or both?

@lonelycode
Copy link
Member Author

Yes it's the same thing as a request ID, mainly used for auditing. To be used by users, we've been asked for this for ages, so much so that we set up a python plugin that does it:

https://github.com/TykTechnologies/tyk-plugin-correlation

But now it can be part of the main build (optionally added by enabling the context variable option in the api spec).

@buger
Copy link
Member

buger commented May 4, 2017

I assume this Task also requires updating documentation

@lonelycode
Copy link
Member Author

Yes it will

@ilijabojanovic
Copy link
Member

@lonelycode @buger I need some documentation or example in order to test this :)

@mvdan
Copy link
Contributor

mvdan commented May 15, 2017

@ilijabojanovic have you seen the test added in the PR? https://github.com/TykTechnologies/tyk/pull/715/files

@mvdan mvdan reopened this May 15, 2017
@mvdan
Copy link
Contributor

mvdan commented May 15, 2017

Meant to just comment, not reopen.

@mvdan mvdan closed this as completed May 15, 2017
@buger
Copy link
Member

buger commented May 15, 2017

@ilijabojanovic yeah, details indeed missing.

Here is documentation for this feature https://tyk.io/tyk-documentation/transform-traffic/request-headers/

To test it, your API definition should have the following global_headers section:

+	"version_data": {
 +		"not_versioned": true,
 +		"versions": {
 +			"v1": {
 +				"name": "v1",
 +				"expires": "2100-01-02 15:04",
 +				"use_extended_paths": true,
 +				"paths": {
 +					"ignored": [],
 +					"white_list": [],
 +					"black_list": []
 +				},
 +				"global_headers":{
 +					"X-Static": "foo",
 +					"X-Request-ID":"$tyk_context.request_id",
 +					"X-Path": "$tyk_context.path",
 +					"X-Remote-Addr": "$tyk_context.remote_addr"
 +				}
 +			}
 +		}
 +	},

So basically this PR's adds a new variable to $tyk_context. And all these context variables should be injected into response headers.

@lonelycode
Copy link
Member Author

I'm a bad person - sorry I should have made it clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants