DEV Community

Wachira
Wachira

Posted on

Archive subdomains for web application

What is your question/issue?

So I am building an application with Node. It's a consignment sort of an application and I want each user that registered acquires a subdomain.

example.com - root domain
user.example.com - when a user creates an account

What technologies are you using?

I am using Nodejs for the API and React as the UI.

What were you expecting to happen?

I just need an idea or resources to achieve new user, a new subdomain

What is actually happening?

I haven't tried out anything yet.

Top comments (2)

Collapse
 
trickymast3r profile image
Tricky Lonely

First you need create an wilcard "*" "A" record for your "example.com", and use headers from request data to get "Host" "user.example.com" when user visit the page.

Browser -> "user.example.com" -> Server -> Request header "Host" -> Output

Collapse
 
wchr profile image
Wachira • Edited

@trickymast3r What about SSL certs? do I have to generate a new one for each subdomain