Hi Experts,
we have tons of proxies defined in apigee, but the client request will be prefixed. For example
/proj/customer (client request.uri) -----rewrite at apigee to> /customer (apigee proxy base path)
I want to chip /proj from the URI the moment it reaches to apigee,i thought of doing it by creating a dummy proxy with a javascript like the one below and forwarding that to the same host pointing the target server to localhost by defining a localhost target server within the apigee. Essentially it's a proxy chaining, is it recommended or any other way to rewrite url at apigee? Pls, provide your approach for this and also how to forward requests to the same host without having a target server defined in hybrid.
var modifiedUri = originalUri.replace("/proj", "");
context.setVariable("request.uri", modifiedUri);
Define a target server with the name localhost and refer apigee dns/FQDN there.
Thanks.
Solved! Go to Solution.
You can use Apigee to do as you describe. It may or ma not be economical to do so, because if you chain proxies, you will run 2 API calls for every request, doubling your Apigee volume.
Many (most?) customers use a load balancer in front of Apigee anyway, and load balancer tools often include URL rewrite capabilities. The Google cloud Load BAlancer (classic) includes this rewrite capability. If that or a similar managed service is not available to you, then you can do rewrites pretty easily with nginx. Here's a tutorial on that. Or you could use envoyproxy to do the same. But this means you would have to manage a group of nginx or envoy servers.
So it's up to you.
Any of these will work fine.