Virtual Host not working when alias is defined

Not applicable

We are working through our private cloud install of Apigee and when we create an environment if we do not specify a virtual host alias I am able to ssh into the server with the rmp and make test calls for a no target proxy I have created once I deploy the proxy to the environment. If during creation I specify a virtual host alias I get when trying to curl for the no-target proxy I created.

{"fault":{"faultstring":"Classification failed for host: xxx.xxx.xxx.xxx url: /alive","detail":{"code":"CLASSIFICATION_FAILED"}}}

/alive is the base path for my no-target proxy.

Any idea why this won't work just when the virtual host alias is specified?

1 8 5,380
8 REPLIES 8

@bryanpfremmer , Welcome to Apigee Community 🙂

Please find more information here regarding virutal hosts & adding aliases.

Not applicable

The port is open after I deploy the proxy I can see a process listening on the port I specified for the virtual host with netstat command.

adas
New Member

@bryanpfremmer If you have specified an alias while creating your virtualhost, Edge uses that alias to match the host header of the incoming request. That's how classification works on the router.

So for example, if you have created a virtualhost called default with hostAlias as myapis.apigee.net and port 9001, then your request should be any one of the following:

Externally:
curl -v http://myapis.apigee.net:9001/alive

Locally:
curl -v http://0.0.0.0:9001/alive -H 'host: myapis.apigee.net'

In both cases the router would match the host name in the request with the hostAlias specified in the virtual host alias. Let me know, if this solves your issue.

Thanks arghya. Your response was extremely helpful to us.

@arghya das -

You said

If you have specified an alias while creating your virtualhost, Edge uses that alias to match the host header of the incoming request.

Can you describe what happens if there is no hostAlias specified for the vhost? How does the classification work in that case?

In the newer implementation, hostAlias is made mandatory which means you cannot keep it empty. In the earlier implementation, if the hostAlias was left empty, the classification would happen based on basepath and virtualhost port.

Thanks, Arghya!

@Dino @arghya das how can we define a format for error coming out of router. In other words , the current error format for virtual host related errors is below

{"fault":{"faultstring":"Classification failed for host: xxx.xxx.xxx.xxx url: /alive","detail":{"code":"CLASSIFICATION_FAILED"}}}

how can i change it to something like this

"error":"Classification failed for host: xxx.xxx.xxx.xxx url: /alive","reason":"please check the virtual host as it doesnt have a match"}

Thanks,

Vednath