Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

is it possible to wildcard alias in virtual host config?

Not applicable

Hi - we are starting to run into a lot of situations (which we didnt predict) where we might need more and more virtual host entries to be able to support our customers.

is it possible to wildcard this setting to prevent us from having to manage a very large list?

Solved Solved
2 14 1,620
1 ACCEPTED SOLUTION

adas
New Member

@Benjamin Goldman

I tested few other scenarios and I feel confident that this works even with the new nginx based router that we are rolling out.

So here's what I did, I deployed a simply proxy in my org with basepath as /apigee/proxy.

I setup my virtualhost like the one below:

POST v1/o/{org}/e/test/virtualhosts

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<VirtualHost name="wildcard">
    <HostAliases>
        <HostAlias>*.api.apigee.net</HostAlias>
    </HostAliases>
    <Interfaces/>
    <Port>80</Port>
</VirtualHost>

This means I can now call the proxy by using different virtualhost aliases like the following:

myorg.api.apigee.net

myapi.api.apigee.net

api-foo.api.apigee.net

as long as all these CNAMEs to your existing apigee hostAlias like {org}-{env}.apigee.net

So when I call the following:

curl -v http://myorg.api.apigee.net/apigee/proxy
curl -v http://myapi.api.apigee.net/apigee/proxy
curl -v http://foo-api.api.apigee.net/apigee/proxy

all of them worked. So you can use wildcards in the virtualhost alias and call it with any of the aliases as long as that matches the wildcard expression. Only exception to this is that you can't have your hostAlias setup as simply "*" or anything that matches an existing virtualhostAlias like x.api.apigee.net

Let me know, if this works for you.

View solution in original post

14 REPLIES 14