Configuring Wildcard Subdomains options

Hello.

I’m looking to move my multitenancy project (frontend) to Netlify.
But I’d like to know if it’d support the features I need.

  1. Is it possible to have wildcard subdomains E.G. .mystore.com pointing to the same site.
  2. Can I still have a fixed subdomain like api.mystore.com as an A record in my domain pointing somewhere else (To the API outside Netlify).

Not a requirement:
3) Is there any way to have a wildcard in the domain mapping. E.G .api.mystore.com pointing to the API somewhere else.
4) if the above is possible, Is there any way to append a header to all requests with the subdomain?

Hey @ighormartins,

  1. Wildcard subdomains are possible with a paid account, and you must either use Netlify DNS so we can get you a wildcard SSL cert, or you must bring a custom wildcard certificate. If these conditions are met, then yes, it’s possible for the subdomains to point to the same site.
  2. Yes, if we’re managing your DNS, you could certainly add an A record pointing to your API.
  3. Not sure I understand this one: are you asking if there’s a way to make a.mystore.com call a.api.mystore.com?
  4. In the abstract, it does seem possible to append a header to all requests with the subdomain. I think you’d have to route through a Netlify Function.

Let us know about #3 and if you have any follow-up questions!

Basically, squashing questions 3 and 4, what I want is something like this (DNS will be on netlify):

api.store.com > A record redirecting to my API
*.api.store.com -> A record redirecting to my API, appending a header [x-store-id] which is the wildcard used
*.store.com -> NETLIFY to my webstie

Hey @ighormartins,
Thanks for your patience on this! Here’s what will work:
:white_check_mark: http://api.store.com > A record redirecting to my API
:white_check_mark: *.store.com -> NETLIFY to my webstie

For pointing *.api.store.com to your API, we’d recommend a CNAME record over an A record. Re: appending a header, there’s not a way to dynamically grab the sub-subdomain and send it in a header unless you use Netlify Functions, which is just adding more stuff (network travel time, build time, etc.) than necessary. We’d recommend getting the subdomain name client-side, parsing it, and then redirecting (again, client-side) by appending that as a query parameter. Would that work for you?