Routing based on host name of requests

Hi everyone

I am trying tyk as possible api gateway to use for the company where I work and from what I understand from the settings documented on the page //tyk.io/docs/tyk-gateway-api/api-definition-objects/ in the section “proxy” of the configurations it seems only possible to do routing based on the path indicated in the “listen_path” option

Is there a setting that allows routing based on the host name indicated in the request header?
If yes, is it also possible to do routing by filtering entire groups of host names with regex or similar pattern-matching functions?

Searching here in the community I have already found references to what seems to be a similar function (Domain / host based routing not path based routing) but from the discussion I cannot find the method that they seem to have used to achieve that.

Just to be clearer, what I’m trying to do is find a method that can do something like this example:

  • get request with Host: something-foo.example.com and route to a target_url ““A””

  • get request with Host: something2-foo.example.com and route to the same target_url ““A””, based on the fact that host something-foo.example.com has a pattern similar to the previous host something2-foo.example.com, which could for example be the regex pattern /^.*-foo(\.[^\.]+)*$/g , but any other simpler filter system that accepts to partially filter subdomain names would be fine.

  • get request with Host: something2-test.example.com and route to to a different target_url ““B””, by matching a different pattern containing -test.

I hope I explained myself enough
Thanks in advance if you can help me get this

Hi!

I haven’t had a chance yet to try this out, but I’ll look into it and get back to you.

Regards,
Nathan