Hi, am currently working on a SaaS product and i will need to create sub-domain on fly as users register on the app. I think this operation is related to the DNS provider or the hosting service, via an API for example. But i don't really know how it work. Looking for some help on this.
Create templates to quickly answer FAQs or store snippets for re-use.
You wouldn't create the subdomain on the fly, you'd simply use a wildcard subdomain (*.yourwebsite.tld) and point that to your webserver.
Depending on what backend framework you are using, you'd need to ingest the subdomain as a parameter and use the value from that to find the user (or throw a 404, of course)
Hope that helps!
oww.... that's interesting... i only knew about SSL wildcard certificat... this is sooo cool. Thank it solve my problem, am working with a NGINX + Gunicorn + Django Stack.. i can handle the domain name ingestion without problem... thank you for this.
Super welcome - glad it helped!
Yup! This is essentially what anymessage does to generate the team subdomains. Feel free to checkout the code, if you'd like a node.js example: github.com/d3sandoval/anymessage
Better to have single VM and single db running for each tenant? Or multitenant single db if that the case?
ie. Slack use subdomain with single db or multitenant db?
if you are using cloudflare they have rest api api.cloudflare.com
with simple http requests you can manage your dns records
this way you can have multiple servers
Ha... I had this kind of solution in mind.. thanks for this. I will check that, it seem to be more suitable concerning security.
yeah cloudflare is great, in the free package they give you tools like waf, ddos protection, cdn, js css optimization etc and your server ip is not exposed to the public because cloudflare works as reverse proxy
You can get wildstar certificates for TLS on AWS, if you want to have a secure connection while serving any subdomain.
yeah thank you, i knew about this type of certificate, i use to get them from GlobalSign.
You could easily get them for free from Let‘s Encrypt.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.