Hi,
I’m trying to define a variable in one proxy and expecting to access it in another proxy. The proxies are connected using LocalTargetConnection. I’m seeing a few issues on this:
-
It seems that the variable set a the calling proxy is not visible in the called proxy. Is this the expected behaviour?
-
The trace functionality doesn’t seem to work when invoking the parent proxy.
-
The parent proxy is kind of filter proxy that passes through requests on /v2/* to the actual proxies in /
e.g. I have these proxies /cars, /movies, etc. then I want to create /v2/cars, /v2/movies, etc. that internally connect to the nonversioned proxies.
- I’d also like to override the HTTPTargetConnection/Path by assigning a dynamic path to the target.url variable, but apparently it still doesn’t work.
Please your help will be very appreciated.
Hello @Julio Rincon,
Please find the response.
- It seems that the variable set a the calling proxy is not visible in the called proxy. Is this the expected behaviour?
[Answer]: Yes. It is an expected behaviour, as the scope of the variables starts and ends within the proxy. So, to set the values of a variable in one proxy and fetch it from another, we typically, store the data in the KVM/Cache and Read the KVM/Cache from the other proxy. There are built in out of the box apigee policies available to read and/or the data from KVM/Cache. Details can be found here and here
- The trace functionality doesn’t seem to work when invoking the parent proxy.
[Answer]: Trace functionality is associated with a particular proxy. So, if you are tracing proxy “Parent”, you should see the run time details for this proxy only and not the “child” one and vice-versa
- The parent proxy is kind of filter proxy that passes through requests on /v2/* to the actual proxies in /
e.g. I have these proxies /cars, /movies, etc. then I want to create /v2/cars, /v2/movies, etc. that internally connect to the nonversioned proxies.
[Answer]: Its possible to call a proxy from another one. You can use the Target Endpoint properties to do so. That is you need to set the Target Endpoint the proxy path you wanted to hit.
- I’d also like to override the HTTPTargetConnection/Path by assigning a dynamic path to the target.url variable, but apparently it still doesn’t work.
[Answer]: You can do so by setting the path variable like this.Here the {uriPath} is a run time variable that I am setting to any value of my need. So the final request to the target endpoint would be {http://{IP}+{uriPath}}
<HTTPTargetConnection>
<LoadBalancer>
<Server name="ABCD">
<IsEnabled>true</IsEnabled>
</Server>
</LoadBalancer>
<Path>{uriPath}</Path>
<Properties/>
</HTTPTargetConnection>
</TargetEndpoint>
Hope this helps..!
So can we dynamically choose between proxy chaining or httptarget connection? as in my scenario based on the request payload i need to either make a call to local proxy which in turn calls a target
or the payload has to be routed to an http target.
can we achieve this? @Meghdeep Basu