Apigee - modify target path when using targetserver

扶醉桌前 提交于 2019-12-06 15:14:51

You can also set it up at the target endpoint by leveraging the Path element along with TargetServer:

<TargetEndpoint>
    ...
    <HTTPTargetConnection>
        <LoadBalancer>
            <Server name="TargetServerABC"/>
        </LoadBalancer>        
        <Path>/v1/YourPathHere/json.ws?{flow.company.queryparams}</Path>
    </HTTPTargetConnection>
</TargetEndpoint>

Note TargetServerABC needs to be a TargetServer created using the following these steps.

There seems to be an issue with manipulating target.path (there is a bug report open in Apigee for this).

The current workaround is to rewrite the entire URI either in the AssignMessage policy using the AssignVariable block:

<AssignVariable>
    <Name>target.url</Name>
    <Value>http://example.com/mypath?param=value&variable={apigee.variable}</Value>
    <Ref/>
</AssignVariable>

or you can do it in Javascript with the context.setVariable function:

context.setVariable("target.url", mycompleteurl);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!