Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How do I transform the path between the proxy and the target load balancer endpoint?

My APIGEE API proxy base path is /ident/post/webhooks, and when the full url https://apigee.url.com//ident/post/webhooks/foo then I need to reroute the traffic to the load balancer url https://ilb.url.com/api/mynew/test/foo. So the path suffix /foo I need to add allong with the load balancer path /api/mynew/test.

I tried with a AssignMessage policy but didn't worked 

 

 

<AssignMessage async="false" continueOnError="false" enabled="true" name="RewriteWebhookTargetPath">
<DisplayName>Rewrite Webhook Target Path</DisplayName>
<Properties/>
<Set>
<Path>/api/mynew/test{request.pathsuffix}</Path>
</Set>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

 

I could see the target url is wrongly forwarded to https://ilb.url.com/foo

 

Also the load balancer is defined in target connection tag.

Target URL is not enough. In my case, I need point to target connection

 

 

<HTTPTargetConnection>
  <LoadBalancer>
    <Server name="httpbin-test-ue1"/>
    </Server>
  </LoadBalancer>
  <Path>/</Path>
</HTTPTargetConnection>

 

 

 

Example code 

 

 
0 1 61
1 REPLY 1

Hello,

Is there any specific reason why you aren't dynamically setting the path variable as a part of your HTTPTargetConnection element declaration? Something as follows should work to expectation given your use case: 

Assign Message Policy (set in the Proxy request): 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage continueOnError="false" enabled="true" name="AM-Rewrite-Path">
<DisplayName>AM-Rewrite-Path</DisplayName>
<Properties/>
<AssignVariable>
<Name>mycustompath</Name>
<Value>/api/mynew/test</Value>
</AssignVariable>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<AssignTo createNew="false" transport="http" type="request"/>
</AssignMessage>

Target endpoint HTTPConnection:

<HTTPTargetConnection>
<LoadBalancer>
<Server name="myserver">
</Server>
</LoadBalancer>
<Path>{mycustompath}</Path>
</HTTPTargetConnection>
 
The path suffix should already be set OOTB (enabled by default), so there shouldn't be a need to set it via flow variable
 
Please let me know your thoughts, thanks!