Load Balancing between multiple targets with user define port

Hi,
We are planning to retire F5 load balancer and trying to implement load balancer future within apigee/google. I created 2 http targets with user defined port, however apigee is appending port 80.I tried to change the port but no luck.

Can someone guide me with correct direction with possible solution.

Thanks,
Raj

Edited: Text Formatting

Hey @rajkalgur,

We’ve seen that your question hasn’t gotten a response yet. We’ll keep checking in on this thread and encourage other members to share their thoughts. :slightly_smiling_face:

1 Like

Hi @rajkalgur,

The issue you’re facing is almost always caused by a <URL> tag in your TargetEndpoint configuration. When the <URL> tag is present, it takes precedence over the <LoadBalancer> configuration, causing Apigee to ignore the host and port defined in your TargetServers.


The Problem: <URL> Overrides Your Configuration

When your HTTPTargetConnection looks like the example below, Apigee will connect to http://some-hostname, which defaults to port 80 for HTTP, completely ignoring your load balancer settings.

Incorrect Configuration (What you likely have):

XML

<TargetEndpoint name="default">
    <HTTPTargetConnection>
        <URL>http://some-hostname/some/path</URL>
        <LoadBalancer>
            <Server name="my-target-1" /> <Server name="my-target-2" /> </LoadBalancer>
    </HTTPTargetConnection>
</TargetEndpoint>


The Solution: Remove <URL> and Use <Path>

To fix this, you must remove the <URL> tag and instead define only the resource path using the <Path> tag. This tells Apigee to get the host and port information from your TargetServer definitions.

Correct Configuration:

XML

<TargetEndpoint name="default">
    <HTTPTargetConnection>
        <LoadBalancer>
            <Server name="my-target-1" /> <Server name="my-target-2" /> </LoadBalancer>
        <Path>/some/path</Path> </HTTPTargetConnection>
</TargetEndpoint>

Let me know if this helps!

1 Like

Thank you for your response. I do not have URL defined. here is the snippet.

RoundRobin

Thanks,
Raj

@rajkalgur I think you are missing part of the snippet.

uploaded here

RoundRobin PROD/subroutine [file.pdf|attachment](upload://9rFil2ieqkNbfENLU333fpZLbVj.pdf) (1.5 KB)

It still is having issues displaying but I was able to see the XML. Could you verify that SSL is enabled in your target servers.

  1. In the Apigee UI, navigate to AdminEnvironmentsTargetServers.
  2. Find and click on your first server, tmw-601, to edit it.
  3. Enable the SSL option. This is usually a checkbox.
  4. Ensure the Port is correctly set to 7171.
  5. Save the changes.
  6. Repeat these exact steps for your second server, tmw-602.

I just verfied. SSL is disabled and 7171 port is a http port. it is not appending 7171 to the target url instead it is http://hostname/mvisv2/uv/sub573/tmww/

based on target configuration. it should be http://hostname:7171/mvisv2/uv/sub573/tmww/

Your backend requires an HTTPS connection, but your TargetServers in Apigee are likely configured for plain HTTP. When a TargetServer in Apigee is not configured for SSL, Apigee attempts to make a plain HTTP connection. In that case, it often ignores the specified custom port and defaults to the standard HTTP port, which is 80. This explains exactly the behavior you are seeing.

Enabling SSL should resolve your issue.

our backend port is 7171 and it is not https enabled. it is a plain custom http port. inside target server configuration, I have disabled ssl and configured custom port however by default it is taking 80 port.

Are you able to share the Proxy bundle?

it seems that there must be a place where the target is being wrongly assigned.

I am unable to attached the bundle which is in zip format.

In that case my recommendation here would be to look through all your configurations and see if you are able to find were the endpoint is being set incorrectly. A good place to start would be < AssignMessage > or < Javacript > policies.

1 Like