variable 'proxy.pathsuffix' does not gets populated in the child proxy in proxy chaining

variable 'proxy.pathsuffix' does not gets populated in the child proxy - in proxy chaining to evaluate the proxy 'pathsuffix' coming from the parent proxy. we are using the below code in many places, but the value in child proxy comes blank. are there any work around available?

var path = context.getVariable("proxy.pathsuffix");

0 3 211
3 REPLIES 3

The behavior you are observing is "by design". Unless you invoke the child with a path (Explicitly).

The workaround is for the child to be "aware" if it has been chained.

You could have the parent inject a header like "parent-proxy-path" with the value of proxy.pathsuffix, before chaining to the child. Then t he logic in the child would have to first examine that header, and if and only if that header was not present, use

var path = context.getVariable("proxy.pathsuffix");

Something like

var path1 = context.getVariable("request.header.parent-pathsuffix");
var path2 = context.getVariable("proxy.pathsuffix");
var path = path1 || path2; 

@Dino,

I also observed variables defined in parent proxy is not getting resolved in child proxies. how do we fix this issue.?

My requirement is to consolidate the hosted-targets deployed in more than 10 api proxies into one single proxy. altogether i have around more than 20 endpoints. each and every flow in target endpoint has some policies defined which uses variables defined in parent proxy. All the variables defined in parent proxies are not getting resolved in child proxy. could you please let me know how do we fix this?

Not applicable

you can set the parent proxy variables to a payload and send it to the child, else you can set as headers or query params also.