i want to route single proxy to two different backend server let say
proxy created named as “TE-Route-Demo” with basepath /v1/mockroute with backend as mocktarget
then i create a another target endpoint as “bin” with http tag with backend as httpbin
so can you help me how to route based on path suffix like
when i hit this url https://rohanjangid-eval-test.apigee.net/v1/mock-routee it will route to mocktarget backend and
when i hit this url https://rohanjangid-eval-test.apigee.net/v1/httpbin it will route to httpbin backend
Hi Rohan,
You have two ways to achieve this.
-
Create two route rules in the proxy endpoint, and check the base path in the condition. Then create two target endpoints e.g. names: mock-target & http-bin-target.
-
Create a single target endpoint, write a java script, and based on the path suffix, set target.url variable and use it in the target endpoint.
Out of the above two ways, I would go for 1st way as it makes the proxy very configurable.
I hope this would help.
hy vivek thanks for the response as i added two target endpoint(backend) and two proxy endpoint
can you please let me know what is the route condition for that
Hi Rohan,
Two target endpoints are fine but I don’t think you need to proxy endpoints. Just create flows in the single proxy endpoitns.
Then in the proxy endpoint xml, add the below configuration
proxy.pathsuffix = "/httpbin"
bin
default
1 Like