How to identify if response is coming from upstream in TYK

Hi Folks

How can we identify if the response we are getting from tyk gateway is coming from Upstream and not from TYK itself or vice versa.

For example: if there is any 429 error, how do we know if this is coming from backend and not from TYK.
Is there any tyk response header by which we can identify it or any middleware where it can be ingested.

Note: Upstream is not in our control to set any additional headers.

Hi @Mohit_Kumar

You can use response plugin, as it have the upstream response details that you want to check or modify, other than that you need to compare messages coming from your upstream and tyk for example if 429 tyk have message like Rate limit exceeded and tyk gateway put response headers like X-Ratelimit-Limit etc for every requests.

Regards,
Shebby

Checking message from response may not be possible as we can not check messages for all http status codes.
Can you confirm if we add any response plugin in API, does it ensures that it will only executes once response is received from Upstream or it will be executed for tyk level responses as well.

@Mohit_Kumar

The gist of it is you can confirm if the response is from Tyk by using either the latency/x-generator response header in the analytics record, the gateway debug logs or observability/tracing.

You can find more information in our Knowledge Base Article