I am facing issue while retrieving the values from response headers incase of 302 redirect from the target system. it is showing valuse as empty but I am able to see the values in apigee console.
I want to retrieve the value : response.header.Location
var responseContent1 = context.getVariable('response.content'); // response is empty
var location = context.getVariable('response.header.Location'); // response is empty
I have tried in the Assign message policy also:
<Header name="Location">{response.header.Location}</Header> // same
Please see the attached screen shot for more details.
Thanks,
Kumar P.
I just created a simple proxy to try to duplicate this scenario and I'm not having any issues.
Please note that I use the ref option and I can retrieve it and assign to another variable:
<AssignVariable> <Name>location</Name> <Ref>response.header.location</Ref> </AssignVariable>
Or, to set the location header in the final response, in your assign message policy, ensure that you the AssignTo entry set with type="response"
<AssignTo createNew="false" transport="http" type="response"/>
Also, if you don't do anything, the default behavior for the platform is to forward the header from teh backend to the client.
Hi @kumar
The javascript snippet looks correct, but i think Location should start with L in lowercase. I think if you change it to lowercase, the snippet will be able to extract the value
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |