开发者

CNAME to an A - pointer To webpage

开发者 https://www.devze.com 2023-03-29 00:49 出处:网络
Is it possible to use a CNA开发者_开发技巧ME pointer, that points to an A pointer that points to the webapplication?

Is it possible to use a CNA开发者_开发技巧ME 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!


The problem is that your virtual hosts are not configured to accept requests for the domain the the CNAME record is for.

You need to set the ServerAlias directive (assuming you are using Apache) so it contains all possible variants that you want to use to access your app.

A CNAME record is simply an alias of an A record, so it will always resolve to the IP that the A record points to. What you need to do is tell your web server how to handle those domains (it's based on the Host: header of the HTTP request).

You will find that you have same problem if you create A records for your other subdomains, instead of CNAMEs.

If you need to dynamically add/remove users, you would probably want to use mod_vhost_alias so you don't have to restart Apache every time you do it.

EDIT Sorry, just noticed the reference to aspx, which presumably means you using IIS, which means I can't tell you exactly how to configure it since I know next to nothing about IIS. Re-tag this question with IIS and someone will probably be able to help :-)

ANOTHER EDIT This page from M$ may help you with IIS virtual hosting, although I still don't know how to do it dynamically/programmatically.

0

精彩评论

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