In an Apigee API Proxy, why does rewriting "target.url" via a JavaScript policy not route to the new target?

StackOverflow https://stackoverflow.com/questions/23277279

  •  09-07-2023
  •  | 
  •  

문제

The use case here is that the target endpoint URL has to be changed based on some conditions. The JavaScript policy used to overwrite "target.url" does not get the call routed to the new target. It still routes to the 'Default Target Endpoint URL' set on the 'Overview' tab of the API Proxy. Here is the JavaScript:

context.setVariable("target.url", url);

where URL is the new target URL value that needs to be set.

http://apigee.com/docs/api-services/content/javascript-object-model shows a similar example and http://apigee.com/docs/api-services/api/variables-reference confirms that the variable reference is correct.

도움이 되었습니까?

해결책

Please ensure the policy for the JavaScript is in the Targets side of the flow (vs. Proxies side). You won't see the change take in effect if the policy is executing in the Proxies side of the flow.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top