How to update proxy.pathsuffix dynamically?

Hello,

I have a need to generated the proxypath something like this below:

/xyz.xsodata/InputParams(IP_USER_ID='abc')/Results/$count

In original request, proxypath is :

/xyz.xsodata.

Cannot go by updating the target url approach as using loadbalancer.

Can anyone please help?

0 7 1,487
7 REPLIES 7

@Neha Raghuvanshi,

You can disable default appending of the pathsuffix by setting target.copy.pathsuffix=false and use a variable in the <Path>{custompath}<Path> setting in the Target endpoint even if you are using a loadbalancer configuration.

Not clear. what do you mean by "I have a need to generated the proxypath"?

It sounds like you want the API Proxy in Apigee Edge to do some path mediation. How, exactly?

Take me through your desired message flow.

  • Client A connects to Apigee Edge with request. Verb:? Path:? params?
  • Apigee Edge API Proxy does X and Y and then sends request with verb:? Path:? params:? to upstream.

shubham90
Participant I

I have a similar requirement as posted by @neharaghuvanshi . 

Client will be calling apigee with baseuri/pathsuffix, before this call is redirected to target I need to modify proxy path suffix to something like:

-----> proxy.pathsuffix = /parent/{id/}proxy.pathsuffix

Why this is needed:

Need to do this, as I need to append this parent information in the target suffix before redirection.

My Approach - Not Working

Using a java call out policy as I need to do a bunch of steps to get this parent information, after which I append this in proxy.pathsuffix, like this:

...
somecode to get and update proxySuffix
...
messageContext.setVariable("proxy.pathsuffix", proxySuffix);

 But when I check traces, proxysuffix is not updated. It shows not equal to symbol in front of updated suffix:

Request TraceRequest Trace

You cannot update proxy.pathsuffix.  It is a readonly variable.

You have to use one Assign message policy in the target endpoint Preflow. 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="MED-AM-RemovePathSuffix">
<DisplayName>MED-AM-RemovePathSuffix</DisplayName>
<Properties/>
<AssignVariable>
<Name>target.copy.pathsuffix</Name>
<Value>false</Value>
</AssignVariable>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

 

AND THEN IN THE taregt configuration - add the path tag

<HTTPTargetConnection>
<Properties>
<Property name="success.codes">2xx</Property>
<Property name="response.streaming.enabled">true</Property>
</Properties>
<LoadBalancer>
<Server name="XYZ-TargetServer"/>
</LoadBalancer>
<Path>/{give the path youwant to append here}</Path>
</HTTPTargetConnection>

Hope this helps.!

asif1808
Participant I

You have to use one Assign message policy in the target endpoint Preflow. 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage async="false" continueOnError="false" enabled="true" name="MED-AM-RemovePathSuffix">
<DisplayName>MED-AM-RemovePathSuffix</DisplayName>
<Properties/>
<AssignVariable>
<Name>target.copy.pathsuffix</Name>
<Value>false</Value>
</AssignVariable>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</AssignMessage>

 

AND THEN IN THE taregt configuration - add the path tag

<HTTPTargetConnection>
<Properties>
<Property name="success.codes">2xx</Property>
<Property name="response.streaming.enabled">true</Property>
</Properties>
<LoadBalancer>
<Server name="XYZ-TargetServer"/>
</LoadBalancer>
<Path>/{give the path youwant to append here}</Path>
</HTTPTargetConnection>

Hope this helps.!