Apache servername anomoly

I have my virtual host ServerName set to mydomain dot hopto dot org, but apache is accepting requests quoting mydomain dot co dot uk

This is too clever and unintended.

mydomain dot co dot uk DOES divert to mydomain dot hopto dot org, BUT 99% of the requests to mydomain dot co dot uk show mydomain dot hopto dot org in the servername field of the apache access log. (as intended).

Why does apache accept requests which quote mydomain dot co dot uk ?

This is happening on both the sites I have enabled.

Sorry I am not allowed to put actual dots in the above.

Hi G109B,

Welcome to our forums.

The ServerName directive in Apache configuration tells the name the virtual host calls itself, not how clients (browsers) find it. That depends on DNS name resolving. Does the .co.uk address redirect to your .hopto.org address, or are the two otherwise related?

Yes, co uk does re-direct to hopto org, but the client request to my system always quotes the hopto address in the servername field when I test it. This is how I want it to work. My apache virtual hosts have ServerName entries set to hopto addresses, so requests quoting co uk addresses should, I thought, access the 000-default folder (html).

By some method I don’t understand, some phishing attacks seem to arrive at my server quoting co uk (which is clever in itself), but worse still, apache seems to serve them files from the virtual host folders.

There is obviously a lot I don’t know about all this.

You could set up a VirtualHost for the co uk address too, which redirects to the hopto org VirtualHost address as well, so by whatever means traffic comes searching for the co uk address, will land on the hopto org address and content.

That is a good idea, I hadn’t thought of virtual hosts for the co uk addresses.
I actually want to stop accesses which don’t quote hopto org, mainly because I don’t understand how requests quoting co uk reach me anyway, so I will create co uk virtual hosts with DocumentRoot set to the default unused html folder. Hopefully this will help solve the mystery.