mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
feat(SimpleWebTransport): adding option to set server and client port different (#3477)
* feat(SimpleWebTransport): adding option to set server and client port different When running websocket server behind reverse proxy client should connect via port 80 or 443. the reverse proxy should then forward requests to the ServerPort running on localhost. * Update Assets/Mirror/Transports/SimpleWeb/SimpleWebTransport.cs --------- Co-authored-by: mischa <16416509+vis2k@users.noreply.github.com>
This commit is contained in:
parent
0f41aa7a3e
commit
f200b907ac
@ -16,6 +16,9 @@ public class SimpleWebTransport : Transport, PortTransport
|
||||
public ushort port = 7778;
|
||||
public ushort Port { get => port; set => port=value; }
|
||||
|
||||
[Tooltip("Tells the client to use the default port. This is useful when connecting to reverse proxy rather than directly to websocket server")]
|
||||
public bool ClientUseDefaultPort = 7778;
|
||||
|
||||
[Tooltip("Protect against allocation attacks by keeping the max message size small. Otherwise an attacker might send multiple fake packets with 2GB headers, causing the server to run out of memory after allocating multiple large packets.")]
|
||||
public int maxMessageSize = 16 * 1024;
|
||||
|
||||
@ -122,8 +125,10 @@ public override void ClientConnect(string hostname)
|
||||
{
|
||||
Scheme = GetClientScheme(),
|
||||
Host = hostname,
|
||||
Port = port
|
||||
};
|
||||
// https://github.com/MirrorNetworking/Mirror/pull/3477
|
||||
if (!ClientUseDefaultPort)
|
||||
builder.Port = Port;
|
||||
|
||||
ClientConnect(builder.Uri);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user