处理多租户 Web 应用程序中的顶级域
因此,我正在为一个应用程序定义架构,我一直在等待启动,但遇到了一些障碍。我在弄清楚如何处理与顶级域结合的多租户方面遇到了一些困难。
这是我想要完成的要点:
用户可以访问该网站并注册一个帐户,注册时他们可以设置应用程序以使用自己注册的域名。我不处理注册(但确实提供了有关如何注册并为大多数域名注册公司指向域名的良好说明),只是其应用程序端。
我很难弄清楚像 Wordpress.com 和 Typepad 这样的网站如何在应用程序级别处理多租户。
假设有一个针对 www.test.com/ 的请求,它到达了我的多租户应用程序,但我如何为正确的站点提供服务?我是否从请求中提取标头并基于该标头提供网站服务?
例如,如果您使用 Apache 作为应用程序的 Web 服务器,则每次有人使用自定义域注册应用程序时,您都无法将虚拟主机配置添加到 apache。因此,他们必须以编程方式处理它,但我似乎找不到任何关于如何在应用程序级别处理顶级域的多租户的明确资源。
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) just 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
总体思路并不难。当请求到达您的应用程序时,您必须解析 url 并从中获取一些租户ID。 asp.net mvc 3 中的类似问题在 问题 中提出。您可以在我们的应用程序中找到我的答案和解决方案。在像 wp 或类似的网站上,我相信代理正在添加一些 http 标头数据来请求,因此应用程序层已经获取了tenantID。
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.