First of all not sure if you task require setting custom header. Tyk allows you to override upstream url using “URL rewrite” plugin, you just need to specify host inside “rewrite_to” field. For example of your “weather” example, it can look like:
In other words you do not need to create multiple APIs to achieve this.
If your use-case require using some conditional logic for routing, like header, it is possible to use our advanced rewriting feature described here URL Rewriting in “Advanced Rewriting” section. Basic idea that you can do conditional url rewrites based on regexp over headers, body, url path, query attributes or user session meta.
Does tyk allow routing of APIs via the root path without a url segment?
Can you clarify it a bit? Do you mean if your versioning strategy use first url segment, tyk should be able to strip version from URL when it get proxies to upstream?
Hey Leon, by this, I meant the ability to setup an API to listen on the root domain, so http://tyk-instance.com/ (<- the / here) will be routed to an API instead of having an API slug. (http://tyk-instance.com/my-api/)
Ah, I see what you mean, for sure it is possible if you will use custom domains, in this case, you need to set “domain” field and set slug to “/”. Also ensure that tyk.conf has enable_custom_domains set to true.