简体   繁体   English

在Apigee API代理中,即使通过JavaScript策略重写了“ target.url”,也无法路由到新目标

[英]In an Apigee API Proxy, Unable to route to new target even after rewriting “target.url” via a JavaScript policy

I have a node.js application(deployed using Hosted Target) (with query parameter). 我有一个node.js应用程序(使用托管目标部署)(带有查询参数)。 What I am trying to do is, When I hit my current url I want to redirect it to a new url (my cloud function url). 我想做的是,当我点击当前URL时,我想将其重定向到一个新URL(我的云函数URL)。 I have used a javascript policy for it. 我已经使用了JavaScript政策。 The script is something like: 该脚本类似于:

var url = 'https://..xyz.com';

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

I have my javascript policy on Targetendpoint Response flow. 我在Targetendpoint Response流上有我的javascript政策。

But I am getting an error: 但我收到一个错误:

Cannot GET /..xyz

This Apigee Community post is about this use case, albeit not within the JS context: https://community.apigee.com/questions/31202/how-to-dynamically-set-target-url.html 尽管不是在JS上下文中,此Apigee社区帖子也与此使用案例有关: https ://community.apigee.com/questions/31202/how-to-dynamically-set-target-url.html

Specifically see: "Make sure that this is done in the Target Endpoint as this variable's scope is restricted." 具体请参见:“确保此操作在目标端点中完成,因为此变量的作用域受到限制。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM