Configuring Multiple different backend

Is it possible for TYK gateway to forward the incoming request to the different backend end point using same API definition and listening PATH. If its possible then how can we do that.

Hello @saloni512,

That is possible through a the batch request method in tandem with the virtual endpoint. Here is an example.

Can you help me understanding in better way with below use case:

Listen path is fixed: /CloudGateway/rest/

Target URI1: /CloudGateway/rest/

Target URI2:

Then how do I configure at the tyk side So that it should generate unique url for each callback url with the same listen path.

As I am doing POC on open source TYK Gateway So the same feature is available with open source?

Yes this same feature is available in the open source version

Honestly, it is not clear what you are asking.
You can configure Tyk to proxy based off Hostname OR listen path.

ie: → goes to some API A → goes to some API B → goes to some API A → goes to some API B

Does this help?

If you have an architecture diagram, it can probably eliminate some of the language barrier

1 Like

HI Sedky,

Below is flow diagram of the scenario, hope it clarifies:


  1. There will be only 1 TYK open source server.
  2. Listen path is going to be common for multiple apps so is TYK is capable to generate unique url for each API with the same listen path which is going to be /CloudGateway/rest/
  3. Bakend (Target URI) can be same or different.

Please let me know If you need more clarification.

Yes, this is completely supported, you’re describing Host Header based routing.

You can set the “domain” field in the API definition and Tyk will route based off that.

API Def 1

"domain": "",
"listen_path": "/test/",
"proxy": {
    "target_url": "",

That means API request to Tyk at http(s):// will be reverse proxied to http(s)://

And that can live alongside API def 2 with a different domain/subdomain.

"domain": "",
"listen_path": "/test/",
"proxy": {
    "target_url": "",

Does this make sense?

I got it, but how do we setup multiple domanins for 1 TYK servers any input on that?

I have created 1 API with below definition;

curl -v -H “x-tyk-authorization: 352d20ee67be67f6340b4c0605b044b7”
-H “Content-Type: application/json”
-d ‘{
“name”: “cloudgatewaydomain1”,
“slug”: “cloudgatewaydomain1”,
“api_id”: “cloudgatewaydomain1”,
“auth”: {},
“org_id”: “1”,
“use_keyless”: true,
“definition”: {
“location”: “header”,
“key”: “x-api-version”
“version_data”: {
“not_versioned”: true,
“versions”: {
“Default”: {
“name”: “Default”,
“use_extended_paths”: true
“strip_auth_data”: false
“domain”: “”,
“proxy”: {
“listen_path”: “/CloudGateway/rest/”,
“target_url”: “https://ip-10-10-31-38.ap-southeast-1.compute.internal:8443”,
“strip_listen_path”: false
“active”: true
}’ --insecure | python -mjson.tool

When I try to access curl, its not working because I think I have not setup the domain

Please suggest here.

Any suggestions here?

Any input here Please


You will need to setup the name resolution for to reach your gateway. This is a client side thing so you it could be a simple as adding to your hosts table with the IP address of your gateway.

You can also use curl to simulate this with something like

curl --resolve

Hope that helps.