I am planning to use TYK as api gateway where I will be publishing different APIs.
Any of these APIs based on different information in header (or some other way), we want it to redirect to different backend application.
Looking for your help and suggestion to evaluate if this capability is present in TYK and how to achieve it.
The backends list is not static but keeps adding based on new backend registered specific for that header (for any such API).
We are currently using APIGEE, where we use KVM to store this information and based on different APIs need, we call relevant backend system.
Thanks & Regards
Have you had a look at our Advance Url Rewrite middleware? There is a snippet there that uses header matches and a session meta data for you to start with.
Or you could use this sample snippet below that works with a httpbin.org upstream to change the URL if a
Digits header key is present with the value
Thanks for the reply!!
Can you guide me how to make it dynamic? I am not looking to publish proxy again as I will be having few backends to be served and I will not be able to update the API definition based on new backend getting added. As mentioned, in APIGEE world, I use KVM to find appropriate backend based on the header.
I am also looking for few APIs, to call another service which tells me the appropriate backend for given header. So request path will be:
I would also like to cache the result from serviceDiscovery to ensure that calls to serviceDiscovery for a header is minimal.
Thanks & Regards
I can only assist to the best of my abilities. Your end result could vary from very simple to very complex. My best advice would be for you to write a custom plugin. Depending on your use case, this may be overkill but at least it gives you control on how you handle the request.
We some documentation regarding Service Discovery and Caching for your perusal.