Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How do I get the full URL that was sent by the client?

I am considering using HMAC to sign requests and I want to include the URL as well as other things (e.g. HMAC = verb + url + nonce + timestamp + body). I don't see a simple way to get the request URL that the client sent, it looks like I have to reconstitute it using:

var req_verb = context.getVariable('request.verb');
var req_scheme = context.getVariable('client.scheme');
var req_host = context.getVariable('request.header.host');
var req_request_uri = context.getVariable('request.uri');
var req_url = req_scheme + "://" + req_host + req_request_uri;

Since the message URI includes the basepath, suffix and params, can I assume what the client sent is what Apigee actually gets? Or could it change in transit?

Solved Solved
0 14 8,220
1 ACCEPTED SOLUTION

Not applicable

var req_verb = context.getVariable('request.verb');

var req_scheme = context.getVariable('client.scheme');

var req_host = context.getVariable('request.header.host');

var req_request_uri = context.getVariable('request.uri');

var req_url = req_scheme + "://" + req_host + req_request_uri;

View solution in original post

14 REPLIES 14