AWS Multiple domains pointing to same server

瘦欲@ 提交于 2019-12-19 04:39:14

问题


I'm building a solution that will be provided to several companies. Any company will have to point their domains (or just a sub-domain) to my server and then I'll handle pages to their customers.

I'm testing it with the following config:

  • CustomerABC.com pointing to one hosted zone into Route 53
  • CustomerDEF.com pointing to another hosted zone into Route 53
  • Both hosted zones have an A record pointing to the same EC2 server instance

That said, every customer that wants to use my service will have to change its domain's DNS to his own hosted zone in my Route53. My server will handle many domains.

I'd like not having to create a new hosted zone for every new customer. Is there any way to achieve the same result?


回答1:


  1. Put Elactic Load Balancer in front of your application instance (even if you will use only one instance at the beginning).
  2. Using your domain (the zone does not have to be hosted on Route53), create one CNAME (or ALIAS) record (for example myapp.example.com) and point it to your load balancer's domain name.
  3. Simply tell your customers to CNAME their subdomain to your app dns name



回答2:


If a business I was looking to do business with told me I needed to create a new zone on my DNS to access an application, I would very quickly move my business elsewhere! Especially if they wanted control of that zone, there are big security issues in allowing that. You will almost certainly lose business if you make that a requirement.

This is a commonly solved problem for thousands of businesses across the internet, you simply tell them to point their domain to your servers and you figure out which customer is which. Either by using something like the HTTP Servername field, or having some manner of authentication process that differentiates them from the other users.

By far the simplest method is having a CNAME record that you point all of your customers to. Depending on your business model it can be useful to give each customer a custom CNAME, some random unique ID, so if you need to expand and move clients in future you can do them a number at a time.

Look around at your competitors, or just generally around other businesses that have similar web models. Understand how they engineer their infrastructure and emulate that. But taking a whole DNS zone, is a really bad idea.



来源:https://stackoverflow.com/questions/35002251/aws-multiple-domains-pointing-to-same-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!