开发者

Get domain the server was reached over?

开发者 https://www.devze.com 2023-03-10 10:50 出处:网络
In general on any non-HTTP server. Would there be a way to detect what domain was used to reach the IP?

In general on any non-HTTP server. Would there be a way to detect what domain was used to reach the IP?

I know HTTP servers get the domain passed within the request header, but would this be possible with any other server that does not require this information to be received from开发者_Go百科 the client?

I'm especially looking for a way to do this with the minecraft server (Bukkit) so my preferred language (if needed for you to answer) would be Java. But I'd like to not have the theories about this language specific.


In general, no, which is why the HTTP protocol includes it in the headers.

In order to reach your server, first a DNS lookup is performed to resolve your IP, which is then followed by the connection itself. These two steps are separate, and hard to link together.

Logging what domain was last requested by a client is tricky, too, as DNS information is often cached, so the DNS request may not even reach your DNS server before being answered.

If it isn't cached, it also often isn't directly looked up by the end client, but rather by a caching DNS server operated, for instance, by the ISP.


No. The only way to get the DNS name used to connect to a server is to have the client provide it.


No, if there are no means for this in the protocol itself like the Host header in HTTP you cannot find out which hostname was used on the client to resolve your IP address.

0

精彩评论

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

关注公众号