I have a proxy with a path of /foo and I want my API to have.
/foo/weather <-- will go to weather API
/foo/location <-- will go to geocode API
/foo/businesses <-- will go to Yelp API
From what I can tell, I can do this in a couple of ways..
Can somebody with a good handle on best practices comment on pros and cons of the two approaches (plus others if I'm missing any -- I'm aware I can probably do the whole thing in Javascript/node or Java but those don't sound like a good idea.
I am looking for specific architectural reasons, and maybe the implementation options for each.. For example, with option #1, I think I can either do a service callout, OR I can alter the request.targetUrl property (not sure about name)... So if option #1 has two derivatives, is one better than the other, etc?
Thanks in advance for the help
Solved! Go to Solution.
Hi @Kd Ford,
From the best practices point of view, you should always try to adhere to separation of concerns. If they serve the same purpose then keep them in one proxy and use route rules to route request pertaining to a target system based on proxy.pathsuffix and other conditions based on your requirement.
As you mentioned /foo/weather is dealing with only with weather APIs then keep it in a separate proxy with basepath /foo/weather similarly for others.
As you mentioned using conditional flows for a target system by overwriting "target.url", this will not be a good approach and will give you maintenance nightmare.