I'm having an issue where I'm getting a slash appended to all requests where there is a URL as a query parameter value.
A call to
http://xxxx-test.apigee.net/slashtest?url=http://xyz.com&x=x
will show in the Apigee trace as:
Request Received from Client GET /slashtest?url=http%3A%2F%2Fxyz.com&x=x%2F
The extra slash is causing difficulties as it is being added to things like api keys and various other parameters.
FYI, this is reproducible on Cloud, and in a proxy with no policies.
By standard query params should be URL encoded. This will necessitate decoding (typically via Javascript) on the proxy tier.
The following snippet demonstrates a Javascript callout to get, decode, and save the decoded version of the param as a flow variable:
var product.id = context.getVariable("product.id"); if (!product.id) product.id = ""; else product.id = decodeURIComponent(product.id); context.setVariable("product.id", product.id);
Hi David,
This issue still occurs if the url value is url encoded.
http://jeffcann-test.apigee.net/slashtest?uri=http%3a%2f%2fxyz.com&x=x
shows up as:
Request Received from Client GET /slashtest?uri=http%3A%2F%2Fxyz.com&x=x%2F
Hi @Jeff Cann , Which client are you using ? can you try with curl as shown below and see if you still see that extra slash at the end ?
curl -v 'http://xxxx-test.apigee.net/slashtest?url=http://xyz.com&x=x'
I don't see that on my instance when I try the above
Request Received from Client GET /notarget?url=http%3A%2F%2Fxyz.com&x=x
Jeff, I have a sample running on my personal org that demonstrates that this is not occurring with the implementation pattern I have above.
Hit
http://davidwallen2014-test.apigee.net/variabledump?foo=bar&lorem=ipsum&lorem=ipsum2&encoded=http%3A...
or
http://davidwallen2014-test.apigee.net/variabledump?uri=http%3a%2f%2fxyz.com&x=x
for a quick validation it should return:
Request Received from Client GET /variabledump?uri=http%3A%2F%2Fxyz.com&x=x
Can I ask which user agent you are using to hit the API?
In putting together my test endpoint I have found a bug in the trace tool which I am opening a JIRA on.
variabledump-rev1-2015-05-20.zip - this is the sample that demonstrates how I am handling the decode...
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |