How to route Requests based on URL Path or Method

Because of Membrane's fallthrough mechanism, only the API that matches will be called, others will be skipped. Like this we can implement selectors for path and methods.

Ingredients

Configuration

<!-- Handles GET requests to port 2000 starting with '/foo' -->
<api port="2000" method="GET">
  <path>/foo</path>
  <target url="server1" />
</api>

<!-- Handles GET requests to port 2000 starting with '/bar' -->
<api port="2000" method="GET">
  <path>/bar</path>
  <target url="server2" />
</api>

<!-- Handles all POST requests to port 2000 -->
<api port="2000" method="POST">
  <target url="server3" />
</api>

Resources

API Documentation