I am trying to write an API proxy that will query a service discovery tool and route to a dynamic end point based on the result of the query.
This is the example i am following for the endpoint rewrite: http://docs.apigee.com/api-services/reference/javascript-policy
That seems to work when i hit the URL in the example: curl -i -H 'Content-Type: application/x-www-form-urlencoded'-X POST -d 'user=Will' http://myorg-test.apigee.net/js-example
But when I try to test my local micro gateway (which pulls in this example code from the Edge UI) the javascript doesn't seem to run and it always hits the default URL. This is what i am hitting locally curl -i -H 'Content-Type: application/x-www-form-urlencoded'-X POST -d 'user=Will' http://localhost:8000/js-example
Are there any settings that need to be enabled locally to allow javascript to run?
Would you like to address this question?
Answer by srinandans · Sep 22, 2017 at 05:42 PM
hmmm, yes, It can be a bit confusing for someone who is familiar with the API Proxy model, but ... Microgateway does not use any policies defined in the API Proxy (including JavaScript). All logic that runs in the microgateway is delivered via "plugins". Please refer here for how to write a custom plugin: http://docs.apigee.com/microgateway/latest/develop-custom-plugins
Plugins are configured (enabled or disabled) in the config.yaml file.
Thank you, that explains why I was seeing that behavior. I will review the plugin documentation and try implementing my service that way.
Microgateway and Apigee plugins 1 Answer
How to access headers added using AssignMessage policy in Microgateway custom plugin 1 Answer
Microgateway Target URL with Query Parameters 1 Answer
Specify different throttling limits for Micro aware proxies? 1 Answer
Edge Gateway vs Microgateway,Apigee Edge vs Microgateway 4 Answers