简体   繁体   中英

Not able to fetch response URL in APIGEE

Heloo I am trying to get the response url from the backend. i am able to get request url, but not able to get response URL. Any suggestions/ ideas are mush appreciated.Thanks in advance.

Assuming your backend sends a redirect URL (as HTTP 302 Location Header) and the URL contains an auth code that you want to extract in the Apigee proxy-flow response path -

You can use a java script policy in the Response path of your proxy flow, like below:

url = context.getVariable("response.headers.Location");
var re = new RegExp("#.*[?&]" + "code" + "=([^&]+)(&|$)");
var code = url.match(re);
context.setVariable("authcode", code);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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