Create subdomain per user

后端 未结 1 1970
粉色の甜心
粉色の甜心 2021-01-03 11:43

How is it possible to create a subdomain for each registered user of the web-site during the registration?
For the scenario below...

  1. User opens si
相关标签:
1条回答
  • 2021-01-03 12:06

    You might approach it like this:

    1. First, establish a wildcard DNS domain (*) for your site's IP address. That will allow anystring.yourdomain.com to resolve correctly.
    2. Configure IIS to bind to a dedicated IP address, but not to rely on host headers (have an empty host header). That will cause all HTTP requests for the bound IP to be directed to your site.
    3. Have an HttpModule that looks at the incoming domain (in HttpContext), and rejects it if it's not valid. You might consider setting a cookie or ticket or something like that, to avoid the need to do a DB lookup for each request in order to validate it.
    0 讨论(0)
提交回复
热议问题