I'm trying to create a proxy bundle that route a proxy like '/v1/{account_id}/account/{user_id}' to a target endpoint URL as 'http://myhost.apigee.net/v1/{account_id}/account/{user_id}'. In this example, calling '/v1/abc/account/123' routed to target endpoint as:
http://myhost.apigee.net/v1/abc/account/123
I read this instruction and this but still I'm not clear about 'proxies/default.xml' and 'target/default.xml' .
I appreciate it if you can provide a simple bundle for the given example.
Solved! Go to Solution.
What you describe is the default behavior for Apigee Edge. You don't need to modify anything.
Set up a proxyendpoint that has a basepath of /v1/foo . Suppose it listens on a vhost with hostname myorg-prod.apigee.net. (Or you can use your own CNAME here, it doesn't matter). This means that the proxyendpoint will handle inbound requests that begin with https://myorg-prod.apigee.net/v1/foo/
Now set up a target in the proxy bundle that points to https://foo.bar.net/v1/bah
Set the routerule to always route to this target. (This is the default behavior when you use the UI wizard to create a reverse proxy.)
If you DO NOTHING ELSE in the proxy bundle, then the inbound request like
https://myorg-prod.apigee.net/v1/foo/abc/people/1234
will result in a request being sent to the target at
https://foo.bar.net/v1/bah/abc/people/1234
By default, Apigee Edge acts as a passthrough.
The "pathsuffix" for the proxyendpoint, which is everything that falls AFTER the basepath for the proxyendpoint, will be appended to the URL you specify for your Target/HTTPTargetConnection . In the example I gave above, the /abc/people/1234 from the inbound request will be appended to the configured target URL to form the complete outbound target URL.