Can't figure out the source of an error in my Target Servers

I'm pulling my hair out with this one. Would appreciate a fresh set of eyes to see if I am doing anything wrong. For confidentiality reasons, I have had to change the names of the servers, but I have double-checked that everything matches in principle.

THIS WORKS FINE:

   <HTTPTargetConnection>
        <Properties/>
        <SSLInfo>
          <Enabled>true</Enabled> 
        </SSLInfo>
        <LoadBalancer>
            <Server name="MyTarget"/>
        </LoadBalancer>
        <Path>/test/backendapp</Path>
    </HTTPTargetConnection>

Where the Target Server config is:

{
  "host": "mycompany.com",
  "isEnabled": true,
  "name": "MyTarget",
  "port": 443
}

But....

THIS DOESN'T WORK

   <HTTPTargetConnection>
        <Properties/>
        <SSLInfo>
          <Enabled>true</Enabled> 
        </SSLInfo>
        <LoadBalancer>
            <Server name="MyTarget"/>
        </LoadBalancer>
        <Path>/backendapp</Path>
    </HTTPTargetConnection>

Where the Target Server config is:

{
  "host": "mycompany.com/test",
  "isEnabled": true,
  "name": "MyTarget",
  "port": 443
}

So basically, moving "/test" out of the Path and into the Target Server configuration causes the call to fail. I get a 503 with a "messaging.adaptors.http.flow.NoActiveTargets" error from the Target Request Flow.

The way that my company's reverse proxy is configured is out of my hands, the environmental switch is managed as part of the basepath, not as part of the server host name.

While I could just write off the error and continue with the first option which works, it's not sustainable long-term. It means developers would need to change the source code to promote the Proxy between environments, which would significantly impact our DevOps process.

at 2:54, suggests this is not the case.

Anyone see what I am missing?

Solved Solved
0 3 128
1 ACCEPTED SOLUTION

Hi @John Ferguson, yes we can only use URL of backend service in Host.

In your first option, we can use dynamic value for env.

<HTTPTargetConnection>
        <Properties/>
        <LoadBalancer>
            <Server name="MyTarget"/>
        </LoadBalancer>
        <Path>/{env}/backendapp</Path>
    </HTTPTargetConnection>

So based on incoming request, the env can be changed.

or

Maybe we can use Multiple target endpoints with route rules.

View solution in original post

3 REPLIES 3

Hi @John Ferguson, yes we can only use URL of backend service in Host.

In your first option, we can use dynamic value for env.

<HTTPTargetConnection>
        <Properties/>
        <LoadBalancer>
            <Server name="MyTarget"/>
        </LoadBalancer>
        <Path>/{env}/backendapp</Path>
    </HTTPTargetConnection>

So based on incoming request, the env can be changed.

or

Maybe we can use Multiple target endpoints with route rules.

@Siddharth Barahalikar - Thanks for the confirmation and suggestions. I'll explore them and figure out the smoothest option.

It's a shame that we cannot include paths in the Target Server. Perhaps a suggestion for a future update?

Although it didn't show properly in the post I wrote earlier, I referenced a 4MV4D video by @Anil Sagar (S14E03) in which he uses Target Servers for environmental routing. In the video, at 2:54, you can see a Target Server configuration which does include paths.Perhaps worth updating the video, as this is potentially misleading?

Yes, I see that in the video, but he is not using that(employee) TargetServer in the demo. He might has created it earlier for some other purpose.

In the docs, it is mentioned that only URL should be given,

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

Check this post,

https://community.apigee.com/questions/45648/change-target-url-while-using-target-server-config.html