​Dynamic Target Endpoint by Environment

Not applicable

I have a proxy. How can I set up dynamic target endpoint like the followings?

Test Environment: target endpoint = https://a.mydomain.net 

Prod Environment: target endpoint = https://a.mydomain.com
0 3 2,580
3 REPLIES 3

Not applicable

I found arghya das already answered it. https://community.apigee.com/questions/2139/dynamic-endpoint-proxy-for-testing-and-production.html

<ProxyEndpoint name="default">
  ...
  <RouteRule name="test">
    <Condition>(environment.name = "test")</Condition>
    <TargetEndpoint>test</TargetEndpoint>
  </RouteRule>
  <RouteRule name="prod">
    <Condition>(environment.name = "prod")</Condition>
    <TargetEndpoint>prod</TargetEndpoint>
  </RouteRule>
</ProxyEndpoint>

ssisodiya
Participant III

@zono

Instead of checking environment at ProxyEndPoint as written by you above, you can configure the TargetServer environment bases and just need to use the created TargetServer alias name at TagetEndPoint.

In your code, if any changes in host, you have to do changes at proxy level and if new environment comes than again one more environnement check is required, Hence it is tightly coupled with proxy.

Creating a TargetServer at environment level is configurable and easy to manageable with much more benefits .

Taget level

<HTTPTargetConnection>
        <LoadBalancer>
            <Server name="mock-bakend"/>
        </LoadBalancer>
        </Path>
</HTTPTargetConnection>

TargetServer Configuration - see the below screen

6856-com-1.png

The same procedure we normally follow.