How to create an SaaS Application?

后端 未结 1 608
粉色の甜心
粉色の甜心 2020-12-25 10:15

I don\'t know how else to say it so I\'m just going to explain my ideal scenario and hopefully you can explain to me how to implement it...

I\'m creating an applicat

相关标签:
1条回答
  • 2020-12-25 10:45

    Subdomains are easy. In hosting environements, in most cases, apache is configured to catch all subdomain calls below the main domain. You just need to have a wildcard DNS defined, so *.example-app.com are pointed to IP of your server. Then your website should catch all calls to those subdomain names.

    Other domains are hard. They need to be configured as virtual hosts in Apache - see http://httpd.apache.org/docs/1.3/vhosts/name-based.html - that means it will be difficult to automate that, especially in hosting environement - unless your host gives you some API to do just that (easy and more feasible scenario would be to have a distinctive IP assigned to your website, then you can catch all with your Apache - it's probably possible to configure using your hosting control panel or works out of the box - and then just point DNS servers to your IP).

    Then, after you have configured your Apache to point all necessary calls to your website, you can differnetiate application partitions per subdomain in this way:

    • get the host header from HTTP request
    • have a database table containing all subdomain names you're serving
    • make a lookup to that database table to determine instance, or user, id and use it later for filtering data / or selecting a database, if you'll go with a "database per application instance" schema.

    Good luck :)

    0 讨论(0)
提交回复
热议问题