Host alias not getting correctly configured

I have two Message Processors :-

10.80.96.4:9002 and 10.80.96.17:9002

I have load-balanced them using 10.80.96.32:9002

I have made three entries for the above as :-

{
    "hostAliases": [
        "10.80.96.4:9002",
        "10.80.96.17:9002",
        "10.80.96.32:9002"
    ],
    "interfaces": [],
    "listenOptions": [],
    "name": "default",
    "port": "9002",
    "retryOptions": []
}

I am able to call all my APIs using any of the above three IPs.

I now have a load-balanced VIP api-abcd.com which is pointing to 10.80.96.32:9002

I have made a new entry like this :-

{
    "hostAliases": [
        "10.80.96.4:9002",
        "10.80.96.17:9002",
        "10.80.96.32:9002",
	"api-abcd.com"
    ],
    "interfaces": [],
    "listenOptions": [],
    "name": "default",
    "port": "9002",
    "retryOptions": []
}

I am able to access my APIs using the three IPs but I am not able to access them using VIP in the host.

I checked the deployments for an API poc-ankit. I found the following :-

http://10.80.96.4:9002/poc-ankit 
http://10.80.96.17:9002/poc-ankit
http://10.80.96.32:9002/poc-ankit
http://api-abcd.com:9002/poc-ankit

Why is 9002 being appended as port in the 4th URL. I want to invoke my API like :-

http://api-abcd.com/poc-ankit

Please help

0 7 285
7 REPLIES 7

@Dino-at-Google

Can you answer my question please or point me to the correct location.

Ankit, in your Virtual Host definition, the port has been defined as 9002. That's the reason why api-abcd.com host alias is getting port 9002:

{
	"hostAliases": [
	"10.80.96.4:9002","10.80.96.17:9002","10.80.96.32:9002","api-abcd.com"],
	"interfaces":[],
	"listenOptions":[],
	"name":"default",
	"port":"9002",
	"retryOptions":[]
}

Just to clarify, a given Virtual Host could only have one port a collection of host aliases (hostnames). If you need to point http://api-abcd.com/ to the same environment, you could create a new Virtual Host with port 80:

{
	"hostAliases": ["api-abcd.com"],
	"interfaces":[],
	"listenOptions":[],
	"name":"default",
	"port":"80",
	"retryOptions":[]

}

You haven't understood my question. My problem is that entire VIP api-abcd.com is already configured to point to 10.80.96.32 at Port 9002 which is the load balancer. I am just not able to make an entry for it in Virtual Hosts without the port 9002.

Also port 443 is irrelevant here because I am currently focusing only on unsecured connection.

Thanks for your response Ankit, I didn't notice that you are trying to use port 80 with hostname "api-abcd.com". Just updated the above example with port 80.

Ideally, you may not need to load balance Apigee Message Processors by creating a Virtual IP. Apigee Message Processors are by default load balanced by Apigee Routers.

Message Flow: Client -> Apigee Routers -> Apigee Message Processors -> Target Endpoints

Moreover, if you are developing an API proxy, you may not need to handle Apigee Message Processor IP addresses using Virtual Hosts. Virtual Hosts are used for configuring API proxy hostname, port, TLS settings, and timeouts:

https://docs.apigee.com/api-platform/fundamentals/virtual-hosts

If you could share your high level requirement, why you are trying to load balance Apigee Message Processors using a Virtual IP and how that relates to a Virtual Host that might be helpful for providing a better answer. Thanks!

The MPs are not load balanced. My routers are load balanced before the message flow comes. I had made an entry for the new load-balancer 10.80.96.32:9002 in Virtual Hosts so that the flow enters any of 10.80.96.4:9002 or 10.80.96.17:9002

The problem is that the VIP api-abcd.com which is an alias for 10.80.96.32:9002 is not being configured correctly in Virtual Hosts.

The VIP is not pointing to port 80. It has been configured to point to 10.80.96.32:9002 and I have also tried giving port 80 to this entry. I still get a 404 URL not found.

I’m not understanding why you would put the VIP in the router config? The VIP, presumably, was configured external to apigee router. The VIP was configured to listen on 80 and forward traffic to one or more IP:9002.

VIP doesn’t belong in router config. Vhost is the gateway listening for traffic from VIP.