mountebank icon indicating copy to clipboard operation
mountebank copied to clipboard

Route to proxy based on path

Open awolden opened this issue 6 years ago • 2 comments

Hello,

We are looking at implementing Mountebank as our main VCR-like virtualization tool. However, most of our microservices are actually located on different domains. With other tools like sepia we can spin up one proxy server and route based on path: https://github.com/linkedin/sepia#url-and-body-filtering. Does mountebank support this behavior where we have one proxy(stub) that can route to multiple downstream services, or would we have to spin up a separate proxy on a new port for every service?

Thanks, and good job on the awesome project!

awolden avatar May 01 '19 20:05 awolden

Hi there, The proxy stub is specific to a single downstream service, and uses the imposter port to simulate that downstream service when it's being replayed. I can think of a couple options that may get you what you need:

  • Create a separate reverse proxy (outside of mountebank) that routes based on path. You may already have this in your load balancer, etc, for example that routes https://api.com/dogs/123 to the dogs service and https://api.com/cats/123 to the cats service. That provides one domain that mountebank can proxy, hiding the complexity of your service decomposition.
  • Or, create some additional automation that explodes a simple configuration into the config mountebank requires. For example, you could have some simply key-value properties file that maps a downstream domain to an imposter port, and a script that transforms that into a series of proxy stubs that mountebank can interpret.

Hope this helps, -Brandon

On Wed, May 1, 2019 at 3:54 PM Alexander Wolden [email protected] wrote:

Hello,

We are looking at implementing Mountebank as our main VCR-like virtualization tool. However, most of our microservices are actually located on different domains. With other tools like sepia we can spin up one proxy server and route based on path: https://github.com/linkedin/sepia#url-and-body-filtering. Does mountebank support this behavior where we have one proxy(stub) that can route to multiple downstream services, or would we have to spin up a separate proxy on a new port for every service?

Thanks, and good job on the awesome library!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bbyars/mountebank/issues/413, or mute the thread https://github.com/notifications/unsubscribe-auth/AAARFP4LN3GUC2LMGW2R7BTPTH7ORANCNFSM4HJX72DA .

bbyars avatar May 04 '19 00:05 bbyars

@awolden I'd love to compare notes with you all at some point. We are working on this at Yelp too.

colinschoen avatar May 06 '19 16:05 colinschoen