Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Custom policy on microgateway

Hi all,

We are using Edge Cloud, and we have microgateway deployments as well.

Currently in Edge Cloud we have a proxy like api.abc.com/v1/customers

which requires the customerid as a path parameter. It then servers different customer objects, like a customers plan, customer location, customers subscriptions.

So when the API is called, is called like

api.abc.com/v1/customers/cus1/plans

api.abc.com/v1/customers/cus2/locations

api.abc.com/v1/customers/cus2/plans

So in Edge Cloud we have a policy that routes between the different plans, locations endpoints.

<RouteRule name="PlanRoute"> <Condition>proxy.pathsuffix ~ "/customers/*/plans"</Condition> <TargetEndpoint>PlanDevEndpoint</TargetEndpoint>

How do we achieve this same thing in on microgateway?

Using a custom node policy? Can someone direct us how to do this?

0 1 196
1 REPLY 1

yes, you could do that with what is known as a "custom plugin" for the microgateway.

I think you want a something that routes requests based on the content of the requests.

There is a variety of plugins available here: https://github.com/apigee/microgateway-plugins/

You could use this code https://github.com/apigee/microgateway-plugins/blob/master/cloud-foundry-route-service/index.js

...as a start and from that, build your own configuration-driven router. It should be pretty simple.

i don't know of anyone who's done it.