How to perform path-based routing in APIcast?

Solution Verified - Updated

Environment

  • Red Hat 3scale API Management
    • SaaS
    • On-premises versions >2.6

Issue

  • How to perform path-based routing in APIcast?

Resolution

To perform path based routing in 3scale the following points are considered the best way to achieve that:

  • API product is configured with mapping rules required to access multiple backend servers at https://foo.com
  • Example mapping rules are defined as:
    • /server1/getemployeedata
    • /server2/getwhateverdata
  • Each backend API is defined as:
    • private base url: https://foo1.com, public path: /server1
    • private base url: https://foo2.com, public path: /server2

When the calls are made to https://foo.com/server1/getemployeedata, the "server1" path fragment is automatically removed, and the resulting call will look like https://foo1.com/getemployeedata

For the complete guide on configuring multiple private backends in a single Product so that path-based routing can be achieved refer to the official documentation for more details.

SBR
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.