HTTPTargetConnection: Dynamically set URL based environment it is deployed?

so i have the ff. code in my TargetEndpoint

  <HTTPTargetConnection>
        <Properties/>
        <URL>http://13.250.4.156:8080/fintech-account-service/accounts/linked
        </URL>       
          <Condition>(environment.name = "dev")</Condition>
    </HTTPTargetConnection>
  <HTTPTargetConnection>
        <Properties/>
   <URL>http://54.169.84.181:8080/fintech-account-service/accounts/linked
         </URL>
 <Condition>(environment.name = "sit")</Condition>
    </HTTPTargetConnection> 

Those dont work though.

PS: I've already done this by having two target endpoints

    <RouteRule name="DEV">
        <TargetEndpoint>LinkedAccountEndpoint_DEV</TargetEndpoint>
        <Condition>(environment.name = "dev")</Condition>
    </RouteRule>
    <RouteRule name="DEV">
        <TargetEndpoint>LinkedAccountEndpoint_SIT</TargetEndpoint>
        <Condition>(environment.name = "sit")</Condition>
    </RouteRule> 

Just looking for a way if its possible to do with just the HTTPTargetConnection on a single target endpoint instead of two.

Solved Solved
0 2 3,323
1 ACCEPTED SOLUTION

Hi Joshua, you should take a look at using target servers instead. This would avoid hardcoding the endpoint in your proxy

You would then have a different target server with the same name configured for each environment.

https://docs.apigee.com/api-platform/deploy/load-balancing-across-backend-servers

View solution in original post

2 REPLIES 2

Hi Joshua, you should take a look at using target servers instead. This would avoid hardcoding the endpoint in your proxy

You would then have a different target server with the same name configured for each environment.

https://docs.apigee.com/api-platform/deploy/load-balancing-across-backend-servers

Thanks, got it working.

Another Question though. I want to add a Target server that is our own apigee since we are using another internal API in our proxies. So if I have google-inc.apigee.net as my host for example. What should the port I input in the fields so that I could all the APIs in that organization?