Handling dynamic subdomains


Just wondering whats the best way to handle multiple domains? E.g. My app will allow users to dynamically create any domain they want for their account (e.g. test.kampsite.co). Currently for this to work I have to have add the alias to netlify under the domain alias section. Im just wondering if there is an easier way? E.g. using the _redirects file (although I don’t want to redirect - I want it to still show as test.kampsite.co) OR possibly using the api?

Hello @harryl,

We do have the feature you describe. It is a feature available for sites on the Pro plan (see https://www.netlify.com/pricing#teams ), and our Support team must explicitly enable it for each site you need it on. There are some conditions as well, but that is the starting point. I’ll be happy to go into details if the price point isn’t a deal breaker.

Hey @Dennis , is it he $45 per month plan you are referring to? If so it’s not a deal breaker (not ideal either - is there a cheaper plan that just offers this? .e.g its just me so I don’t need 3 members) though. Currently on the free plan, how many domain aliases do I get? Also what are the conditions? Be good to know them before committing.

@Dennis I’ve purchased the pro plan and transferred my domain, however, I can’t see the option to add wilcard domains (or I have added a wildcard subdomain but it’s not working)

Hi @harryl, The wildcard subdomain feature can only be enabled by Support. I opened a helpdesk ticket for you with additional information. We can continue getting you set up there.

Hi @Dennis, can you please enable wildcard subdomains on my account also?

Hi, @cvv. I don’t show any logins at Netlify using this email address. What site are you requesting this be enabled for?

You can post that information publicly or you can private message (PM) that to one of our support staff. I’ve confirmed that PMs are enabled for your community login. Please keep in mind that only one person can see the PM and this will likely mean a slower reply than posting the information publicly. Please feel free to reply to however you prefer though.

Hi, @cvv. I received a PM from you with the account details. The team mentioned is on a Pro plan so I would recommend sending an email to support@netlify.com from that email address and we will be happy to assist with enabling the wildcard subdomain feature for your sites. (You can also enter that email address into the form at Support | Netlify if you prefer.)

To get the ball rolling on this prior to that email being sent, this is the information we send whenever someone asks for this feature to be enabled:

Wildcard subdomains aren’t enabled by default and can only be enabled from our end. There are a few requirements before we’re able to do so:

  1. Either you have to use Netlify DNS so we can get you a wildcard SSL cert, or you must bring a custom wildcard certificate.
  2. We can only do this for a site that’s on a paid team (see Netlify Pricing and Plans for details)

Also note:

  • You can’t use domain aliases on the site with Wildcard subdomains enabled, just the bare domain and subdomains under your primary domain. If you try to add a domain alias then it won’t work.
  • The primary custom domain for the site, if it is a “site.com+www.site.com” setting in our UI, must be www.site.com and NOT site.com!

Once the wildcard subdomain feature is enabled, you do not need to add new subdomains under the site settings. You’ll will need still need to create DNS records.

This might be a single wildcard DNS record for all subdomains (like a CNAME for *.example.com pointing to the netlify.app subdomain for the site). Alternatively, you can also create the individual DNS records to add each subdomain (like CNAMEs for subdomain-a.example.com , subdomain-b.example.com , etc.) as covered in our external DNS documentation. Both work so please do whichever you prefer.

Please also be aware that we do not current have any built-in method of doing server side “domain-specific” handling - for instance if you want a redirect to automatically redirect from x.yourdomain.com to a path of x based on that subdomain, you’ll have to do that in client-side JS (you can make hostname-specific redirects, but those require the full hostname to be input into each rule, which defeats the zero-config nature of this feature), so please share your use case with us if you are worried about any of the limitations above so you don’t spend time implementing to this feature only to discover limitations that block your use.

Assuming no questions, please let me know which site you’d like to configure with this feature, and I’ll verify that it meets the requirements and get that set up for you.