ngx_stream_minecraft_forward_module
module is an Nginx module that's able to explicitly sieve Minecraft Java game traffic.
- Sieve and replace client-provided server hostname.
Important
- This module relies on stream module.
- Only suitable for Minecraft Java protocol since Netty rewrite.
- Nginx no earlier than 1.11.5 can pass compilation with this module.
-
Syntax:
minecraft_server_forward off|on;
Default:minecraft_server_forward off;
Context: serverIndicate a server block that proxies Minecraft Java tcp connections.
Caution
Set to on
only when upstream server is a Minecraft Java server, otherwise proxy won't function properly.
-
Syntax:
minecraft_server_hostname hostname.to.be.replaced new.hostname [arbitrary];
Default: None
Context: stream, serverWhen a client starts logging process, replace client-provided server hostname with a new hostname before proxying to remote Minecraft server.
If Nginx is compiled with PCRE, the module applies a simple validation against
hostname.to.be.replaced
andnew.hostname
. Setarbitrary
option to bypass the validation.
Tip
Due to differences in Minecraft Java protocol specification, should there be a SRV record _minecraft._tcp.a.domain.for.example.com
that points to another.domain.for.example.com
, consider define two replacements:
minecraft_server_hostname a.domain.for.example.com new.domain.for.example.com;
minecraft_server_hostname another.domain.for.example.com new.domain.for.example.com;
-
Syntax:
minecraft_server_hostname_hash_max_size size;
Default:minecraft_server_hostname_hash_max_size 512;
Context: stream, serverSet the maximum size of hash tables used by
minecraft_server_hostname
directive. -
Syntax:
minecraft_server_hostname_hash_bucket_size size;
Default:minecraft_server_hostname_hash_bucket_size 64;
Context: stream, serverSet the bucket size for hash tables used by
minecraft_server_hostname
directive. -
Syntax:
minecraft_server_hostname_disconnect_on_nomatch off|on;
Default:minecraft_server_hostname_disconnect_on_nomatch off;
Context: stream, serverClose connection if client-provided server hostname matches no replacement.
-
Syntax:
minecraft_server_hostname_replace_on_ping off|on;
Default:minecraft_server_hostname_replace_on_ping on;
Context: stream, serverWhen a client starts pinging, replace client-provided server hostname with a new hostname before proxying to remote Minecraft server. This option is recommended pinging servers behind third-party services (e.g. TCPShield.com) that impose inspection on pinging packets.