0

Is it possible to use a CNAME pointer, that points to an A pointer that points to the webapplication?

I've tried this multiple times now, without any success, and i start to think that it is not possible?!

i got this "Bad request, invalid hostname" think its an 400 error.

If it is not possible to do it this way, can someone please give me some ideas how to start?

My web application:

I got a couple of users registered at my web application. Each users is supposed to get an sub domain, for example, user1.mydomain.com (A-pointer to web.mydomain.com, where all the aspx filer are)

by reading the domainname I get the userID.

If this is not possible i have to put a lot of files in each domain, which i dont want to do. what would you do? wildcards is not possible.

Why a cname to a A? i have to take into account that each user maybe want to point their domain to his or her account at my place. so their pointer should be a CNAME...

Thanks!

4

1 回答 1

1

问题是您的虚拟主机未配置为接受对 CNAME 记录所针对的域的请求。

您需要设置ServerAlias指令(假设您使用的是 Apache),以便它包含您想要用来访问您的应用程序的所有可能的变体。

CNAME 记录只是 A 记录的别名,因此它将始终解析为 A 记录指向的 IP。您需要做的是告诉您的 Web 服务器如何处理这些域(它基于Host:HTTP 请求的标头)。

如果您为其他子域而不是 CNAME 创建 A 记录,您会发现您有同样的问题。

如果您需要动态添加/删除用户,您可能需要使用mod_vhost_alias,这样您就不必每次都重新启动 Apache。

编辑抱歉,刚刚注意到对 的引用aspx,这可能意味着您使用 IIS,这意味着我无法确切告诉您如何配置它,因为我对 IIS 几乎一无所知。用 IIS 重新标记这个问题,有人可能会提供帮助:-)

另一个编辑M$ 的 这个页面可以帮助您使用 IIS 虚拟主机,尽管我仍然不知道如何以动态/编程方式进行。

于 2011-08-19T10:15:41.350 回答