开发者

Handling Top-Level Domains in Multi-Tenancy Web Applications

开发者 https://www.devze.com 2023-02-27 13:34 出处:网络
So i\'m in the middle of defining the architecture for an application I\'ve been waiting to start and have hit a bit of a bump. I \'m having a bit of a hard time figuring out how to handle multi-tenan

So i'm in the middle of defining the architecture for an application I've been waiting to start and have hit a bit of a bump. I 'm having a bit of a hard time figuring out how to handle multi-tenancy in conjunction with Top-Level domains.

Here's the gist of what I am trying to accomplish:

Users can come to the site and register for an account, when they register they can set up the application to use their own registered domain name. I'm not handling registrations (but do provide good instructions on how to register and point the domain for most Domain Registration companies) j开发者_如何学Goust the application end of it.

What I am having a hard time figuring out is how sites like Wordpress.com and Typepad handle the multi-tenancy at the application level.

So say a request comes in for www.test.com/ it reaches my multi-tenancy application but how do I serve the correct site? do I pull the headers from the request and serve a site based on that.

For instance if you were using Apache as your web server for your application, there's no way you would be adding virtual host config to apache every time a person registered for the application with a custom domain. So they have to be handling it programmatically but I can't seem to find any resources that are clear about how to handle the multi-tenancy of top-level domains at the application level.


General idea is not that difficult. When request gets to your application you have to parse url and get some tenantID from that. Similar question in asp.net mvc 3 was asked on question. You'll find my answer there with solution in our application. On sites like wp or similar i believe that proxy is adding some http header data to request so the application layer already gets tenantID.

0

精彩评论

暂无评论...
验证码 换一张
取 消