Hi @dchiesa1 @kurtkanaskie We have a requirement where there are two different URI paths to the target & which calling target server from apigeex Is there a way to replace path dynamically in the HTTPTargetconnection? Is there a policy that could check the incoming request.uri & set the path to the HTTPTargetconnection dynamically?
/act/connector/boston/ship
/act/connector/boston/price
/act/connectors/boston/cancel
/config/v1/PasswordoAuth/login
/config/v1/Passwordoauth/token
Yes, that is a common scenario. You have options.
Option 1 - set `target.url` directly in the target flow. Then it doesn't matter what's in the `URL` of the HTTPTargetConnection.
<AssignMessage name="AM-Target-URL">
<!-- Put in target pre flow -->
<AssignVariable>
<Name>target.url</Name>
<Ref>target_scheme_host_basepath_and_suffix</Ref>
</AssignVariable>
</AssignMessage>
Option 2 - set the `URL` path suffix using a flow variable
<AssignMessage name="AM-Target-Params">
<AssignVariable>
<Name>target.copy.pathsuffix</Name>
<Value>false</Value>
</AssignVariable>
<AssignVariable>
<Name>target.copy.params</Name>
<Value>false</Value>
</AssignVariable>
<AssignVariable>
<Name>new_target_pathsuffix</Name>
<Value>echo/hello/apigeek</Value>
</AssignVariable>
</AssignMessage>
Set the `URL` using flow variable.
<HTTPTargetConnection>
<!-- Neither of these work, need to use AM-Target-URL, last 2 works in Service Callout tho -->
<!--
<URL>https://{flow.target.host_basepath_and_suffix}</URL>
<URL>https://{flow.target.host}/{flow.target.basepath_and_suffix}</URL>
<URL>https://{flow.target.host}/{flow.target.basepath}/{flow.target.suffix}</URL>
-->
<!-- This doesnt work, needs protocol -->
<!--
<URL>{flow.target.scheme_host_basepath_and_suffix}</URL>
-->
<!-- This works -->
<URL>https://mocktarget.apigee.net/{new_target_pathsuffix}</URL>
</HTTPTargetConnection>
Hope that helps!