Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop other domains from pointing to my domain?

Tags:

c#

asp.net

iis

dns

I recently found out that there are other domain names pointing to my website (that don't belong to me) and I was wondering how people can stop/prevent this from happening. I'm hosting this on peer1 using IIS and I'm using ASP.NET C#.

Can I use an HttpModule or some other code to reject domain names that aren't mine?

Is there a better way?

like image 920
locoboy Avatar asked Jul 12 '11 15:07

locoboy


2 Answers

You should activate name-based virtual hosting and only show your real website for the desired domain names. For all other names, you can display a suitable error message.

Details: Your webserver is contacted by its IP address. There is nothing you can do to stop that. Anyone can say, "connect to that IP address". For instance, anyone can register new domain names to point to your server's IP address. However, inside the request, there is a field Host with a name like www.example.com.

Upon receiving the request, your server may choose to inspect the Host field and deliver different content depending on that value. In the simplest case, the server ignores the field entirely and always prints out the same content. But in a more sophisticated set-up, so called "name-based (virtual) hosting", the server chooses the content depending on the hostname.

This is how shared webhosts work: There's a single server, but depending on the requested hostname it spits out a different website for each name.

Therefore, if you want to tie your server content to your hostname, you have to tell your server to produce your website only for your desired name, and to produce a different (error) website for all other cases.

In Apache this is trivial to configure, just check their documentation; for IIS I wouldn't know but I imagine it's equally simple.

like image 70
Kerrek SB Avatar answered Sep 30 '22 17:09

Kerrek SB


If your hosting environment is IIS and you have admin access to it. Set your default website to show an error page and then create a new site with the host header matching your domain to point to your website.

like image 22
Bob Vale Avatar answered Sep 30 '22 17:09

Bob Vale