nik
nik

Reputation: 1574

Add key-value in request header in Apigee

I'm using Apigee as a proxy server for backend API's.My problem statement is to add host ip in request header(Received from API consumer) and forward it to backend server.I'm accessing IP address using context variable "proxy.client.ip".How to add this value in header and pass it further.I have tried following solutions-

var contentIp = context.getVariable("proxy.client.ip");
context.setVariable("IpValue", contentIp);

It is showing value in variables,while debugging trace session.But how to add it in request headers.Thanks.

Upvotes: 0

Views: 984

Answers (1)

nik
nik

Reputation: 1574

Issue resolved using "Assign Policy"- Added

<Header name="IpValue">{proxy.client.ip}</Header>

in policy file.

Upvotes: 1

Related Questions