I have a proxy in which the target endpoints default i've created the following load balancer target server which then depedant on the proxy environment eg. Prod, test etc routes to the relevant target specified in the environment configuration. This works perfectly as entered as per below :
<HTTPTargetConnection>
<LoadBalancer>
<Server name="target1"/>
</LoadBalancer>
<Path>/api/v1</Path>
</HTTPTargetConnection>
The question i have is that in the proxy endpoints flows i have two endpoints with a route rule to a different URL as they use a different path completely and their target is set as
<URL>https://example.com/reports</URL>
eg :
<RouteRule name="screening_report">
<Condition>(proxy.pathsuffix MatchesPath "/example1_report**") and (request.verb = "GET")</Condition>
<URL>https://example.com/reports</URL>
</RouteRule>
<RouteRule name="trade_report">
<Condition>(proxy.pathsuffix MatchesPath "/example2_report**") and (request.verb = "GET")</Condition>
<URL>https://example.com/reports</URL>
</RouteRule>
Is there a way to load balance these two endpoints also defining environment using the target server config? eg again being able to specify relevant back end environment?
Solved! Go to Solution.
You mentioned - The question i have is that in the proxy endpoints flows i have two endpoints with a route rule to a different URL as they use a different path completely and their target is set as
Are you saying you have the same host but the relative paths are different? or both routes are two different targets altogether
Assuming your requirement is to route to the same host, but different paths - You could define multiple target endpoints and reference that in the routerules, both target endpoints can connect to the same target server or different one, and route to a different relative path.
<RouteRule name="target1"> <TargetEndpoint>TargetEndpoint1</TargetEndpoint> <Condition>(proxy.pathsuffix MatchesPath "/example2_report**") and (request.verb = "GET")</Condition> </RouteRule> <RouteRule name="target2"> <TargetEndpoint>TargetEndpoint2</TargetEndpoint> <Condition>(proxy.pathsuffix MatchesPath "/example1_report**") and (request.verb = "GET")</Condition> </RouteRule>
You need to use the <Path></Path> along with the loadbalancer definition
Targetendpoint1
<Path>/users</Path>
TargetEndpoint2
<Path>/todos</Path>
Here is an example. multipletargets-rev3-2018-12-17.zip
Hope this helps