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

How to access headers added using AssignMessage policy in Microgateway custom plugin

I have a proxy created with Assign Message policy in the pre-flow which adds a header with it's value. I am trying to build a Microgateway custom plugin which needs to access this request header of that proxy.

I have tried printing the request.headers of the onrequest event handler but it does not reflect the newly added headers. Although these headers are visible in the trace response

My ultimate aim is to read a variable assigned from a previous KVM policy and pass that variable to custom plugin.

Please let me know how this can be achieved or a better way to implement such solution.

Solved Solved
1 4 1,179
1 ACCEPTED SOLUTION

Thanks for the clarification on the assign message policy usage in the microgateway and sorry for the delay in response, I got sidetracked a little bit.

We were looking to dynamically lookup an endpoint for the target endpoint in the proxies deployed on microgateway. The endpoints are environment specific so when we promote the proxy to the higher regions we are looking up a KVM defined on Edge and retrieve the environment specific target endpoints.

Figured out there is a plugin documented at : https://github.com/srinandan/router where srinandan explains how in the microgateway this can be achieved with the lack of TargetSerer that is available on Apigee Edge proxy implementation.

The above plugin was added to the microgateway instance and we are now able to use the same proxy in all regions.

We were trying to achieve the same using assign message policy to add a header to contain the kvm endpoint and use it in a javascript/custom plugin to set the target endpoint and were unable to read the added header in the plugin.

appreciate your help on this issue.

View solution in original post

4 REPLIES 4