node.js - How to use multiple subdomains and angular apps with nodejs -


i want able use multiple, dynamic subdomains, account holders, while having api subdomain. below:

https://example.com --> angular 4 public landing page app https://api.example.com --> nodejs api https://otbs.example.com --> angular 4 saas application https://test-account.example.com --> angular 4 saas application 

the public landing page app angular 4 app public facing application, whereas saas application actual application itself, when users logged in, , mapped subdomain per linked account.

i using nodejs, express 4, angular 4, , angular cli. intention use s3 serving client angular applications, while having nodejs api run in elasticbeanstalk.

is configuration possible? have looked in virtual hosting on aws, isn't i'm looking need ability register new subdomain every time new account created.

we have done using aws cloudfront wildcard dns mapping through route53. approach map *.example.com cloudfront distribution , use override record set api.example.com api in route53 api pointed express webserver. steps follows.

  • when user creates account can store assigned subdomain(virtual) them in backend.
  • after user logs in through login (login.example.com) page he/she redirected subdomain token or cookie.
  • optionally if single user needs in multiple subnets can provide option select after login or go default 1 user can switch internally.

here subdomain merely mask actual mapping validates backend. regardless of subdomain if user goes subdomain angular app loads since wildcard validated api requests , relevant messages can shown users.

also can connect api same cloudfront distribution behavior redirect (e.g api/*) angular app doesn't cors issue.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -