Maybe a question for the wrong place, but is it po...
# help
r
Maybe a question for the wrong place, but is it possible to assign multiple different `DomainName`s to an API? And asssign them to the base path? E.g.
<http://api-x.company.com|api-x.company.com> -> /
<http://api-y.company.com|api-y.company.com> -> /
?
t
Api gateway supports wildcard subdomains so you can have *.company.com and then in the code get the sub domain and do what ever you want
r
Ahh! So a Wildcard
Certificate
+ a
DomainName
with
*.<http://company.com|company.com>
as the
domainName
would be valid? Then it's just all down to DNS/lambda logic?
t
Think so! 🙂
f
Thanks @Thomas Ankcorn!
r
Looks like we've got pre-existing domains at the same level the wildcard would be, which is not allowed apparently. So figuring out an alternative. Ty for the doc link!
f
Oh I see. If we did something like this:
Copy code
new Api(this, "Api", {
  customDomain: "<http://api-x.domain.com|api-x.domain.com>",
  alternativeDomains: [
    "<http://api-y.domain.com|api-y.domain.com>",
    "<http://api-z.domain.com|api-z.domain.com>",
  ],
  routes: {
    "GET /notes": "src/list.main",
  },
});
And this will create multiple domain ur Api Gateway console. Will this work for you?