Recommended way to proxy requests to multiple backends based on path


#1

Imported Google Group message. Original thread at: https://groups.google.com/forum/#!topic/tyk-community-support/anCKFkiNBHE Import Date: 2016-01-19 21:25:02 +0000.
Sender:[email protected].
Date:Thursday, 24 September 2015 10:18:21 UTC+1.

We got an architecture where most endpoints of our API are served by different backends, while some are served from the same backend.
Example:
/path1 -> service1.internal/ (java)
/path2 -> service2.internal/ (php)
/path3 -> service3.internal/ (golang)
/path4 -> service3.internal/ (same backend as above)

What is the recommended way to use Tyk as the gateway here?

  • Set up one API per endpoint?
  • Use js to proxy based on path? (a proxy/path middleware would be nice)

Any suggestions are welcome :slight_smile:

  • Jens

#2

Imported Google Group message.
Sender:Martin Buhr.
Date:Friday, 25 September 2015 07:05:25 UTC+1.

Hi Jens,

The best thing to do (lowest latency) would be one API per endpoint.

It’s not possible to modify the host in the JS Plugin middleware, only the path itself, currently an API will only route to single upstream host (or hosts if load balancing)

It’s been mentioned before to have multiple upstream domains, and we’re considering adding an override on a per-path basis in a future version.

Cheers,
Martin