Issue
You'd like to create custom subdomains for each of your users, like username.somecoolsite.com
.
Resolution
We expect that most customers requesting a limit increase will be adding and managing domains programmatically using the Heroku API. However, adding and managing domains for an app can also be done within the "Settings" tab of the app's Heroku Dashboard.
Request a custom domain limit increase
There is currently a limit of 1,000 domains per app. This limit can be raised by the Heroku Support team if you submit a support ticket requesting an increase. Please provide details about your use case and suggest a new limit in the ticket.
Make use of Heroku's Platform API
We offer several Domain endpoints which make managing an app's domains easy to do programmatically. You will likely need to embed some domain-management logic into your app's code, perhaps something like this:
-
Get a list of all the custom domains currently in use for the app using the Domain List endpoint.
-
If the new custom domain to be added is not in this list, use the Domain Create endpoint to add it to the app. You will need to handle the case where the domain to be added is already in use.
-
Your customers will need to update their DNS records to point to the new DNS targets generated by Heroku. You will need to provide your customers with these DNS targets and they will need to make any necessary adjustments in their DNS provider's dashboard. Please note that some DNS providers do not support ALIAS/ANAME records, which means that some of your customers may need to switch DNS providers if they want to use custom root domains with your service. You can read more about this here: https://help.heroku.com/NH44MODG/my-root-domain-isn-t-working-what-s-wrong
-
If a user cancels their membership with your SaaS product, you can use the Domain Delete endpoint to remove their custom subdomain.
Special notes for SSL certificates
-
Previously, ACM supported only 100 domains per app. Our new Automated Certificate Management (ACM) system now supports up to 1000 domains. But, it cannot be used on apps with more than 1000 custom domains.
-
If you require SSL for more than 1000 custom domains on one app, you have 2 alternatives:
-
You could use SAN certs through SNI as described in our How do I enable SSL for my app that has more than 100 custom domains? article in the Help Center.
-
You could use a 3rd party solution such as Cloudflare's SSL for SaaS Providers.
-