Minecrell / ServerListPlus

A flexible Minecraft plugin to customize the appearance of your server in the server list
https://git.io/slp
GNU General Public License v3.0
236 stars 60 forks source link

SLP Virtual Hosts | Non-functional with SRV, or proxied records #326

Open MackenzieMolloy opened 3 years ago

MackenzieMolloy commented 3 years ago

Virtual Host (MOTD) doesn't work when the domains are either setup with SRV records or proxied through a service such as Cloudflare.

I did notice there was an issue from 2015 about this, and how it's almost impossible to add, but maybe have a look at DomainAnalysis which tracks domain usage perfectly... not sure if there is any difference between a ping, and a connection. https://www.spigotmc.org/resources/domainanalytics.81585/ <-- They also provide the source code via GitHub Repo.

stephan-gh commented 3 years ago

AFAICT they just use getVirtualHost(): https://github.com/FlowZz99/DomainAnalytics/blob/53db0536aaba1bd564141fe0c0a635788212e71d/src/main/java/it/flowzz/domainanalytics/listeners/PlayerLoginEventListener.java#L37

which is the same I use:

https://github.com/Minecrell/ServerListPlus/blob/7221f5d636575f980206b54f9f358ffb1036e7d8/Bungee/src/main/java/net/minecrell/serverlistplus/bungee/BungeePlugin.java#L183

So I would expect it to return the same values.

MackenzieMolloy commented 3 years ago

Odd, could the difference be that with SLP - it's a "ping" and DomainAnalysis is for connections to the server?

As when I enable proxied, or use a SRV record - the MOTD is that set to the personalise/description default.

Hosts: mc.frozenwaters.net: Default: Description:

  • |- &3&l Frozen&b&lWaters &7[1.8 - 1.16] &c We're back, bigger and better than before! play.frozenwaters.net: Default: Description:
  • |- &3&l Frozen&b&lWaters &7[1.8 - 1.16] 2 &c We're back, bigger and better than before!

Default: Description:

  • |- &3&l Frozen&b&lWaters &7[1.8 - 1.16] &c We're back, bigger and better than before!
  • - &3&l Frozen&b&lWaters &7[1.8 - 1.16] &c We're back, bigger and better than before! Players: Hover:

    &3&l Frozen&b&lWaters &7[1.8 - 1.16] &c We're back, bigger and better than before! Personalized:

Description:

  • |- &3&l Frozen&b&lWaters &7[1.8 - 1.16] &c We're back, bigger and better than before!
  • - &3&l Frozen&b&lWaters &7[1.8 - 1.16] &c We're back, bigger and better than before! Players: Hover:

    &3&l Frozen&b&lWaters &7[1.8 - 1.16] &c We're back, bigger and better than before!

stephan-gh commented 3 years ago

Odd, could the difference be that with SLP - it's a "ping" and DomainAnalysis is for connections to the server?

It seems unlikely but it is possible. In any case, I'm sure that SLP is making use of all the information that is available. If it's not working it seems to be a limitation of the protocol.

What I mentioned in https://github.com/Minecrell/ServerListPlus/issues/52#issuecomment-116677886 probably still applies - if you are making use of SRV records you need to match the destination hostname of the SRV in the virtual hosts.

MackenzieMolloy commented 3 years ago

Ah, yes. I got it working (using play instead of play.domain.net) ... might be useful if you could specify that on the wiki. As I myself was thinking with SRV records - it was the full domain.

stephan-gh commented 3 years ago

Ah, yes. I got it working (using play instead of play.domain.net) ... might be useful if you could specify that on the wiki. As I myself was thinking with SRV records - it was the full domain.

Sorry, now I'm confused. play isn't a real domain... Could you explain how you set up the SRV/... whatever records?

MackenzieMolloy commented 3 years ago

In the config I sent above, I replaced "play.frozenwaters.net" with "play" and that made it work. I'm using a unproxied A record along with a SRV record.

stephan-gh commented 3 years ago

But the SRV record doesn't point to play I assume? Not sure why the end of the domain suddenly disappears...

MackenzieMolloy commented 3 years ago

This is how I have my records setup;

A Record image

SRV image