mc-router icon indicating copy to clipboard operation
mc-router copied to clipboard

Ability to passthrough PROXY protocol

Open clrxbl opened this issue 2 years ago • 5 comments

When a reverse proxy sends PROXY protocol to mc-router, mc-router will reject the connection:

time="2022-12-29T14:11:17Z" level=info msg="Got connection" client="217.182.27.248:32991"
time="2022-12-29T14:11:17Z" level=error msg="Unexpected packetID, expected handshake" client="217.182.27.248:32991" packetID=10

It would be great to have the ability for mc-router to pass through PROXY protocol from the connection to the backend server.

clrxbl avatar Dec 29 '22 14:12 clrxbl

Can you clarify the use case such as with a simple network diagram? mc-router already has the option to originate PROXY to the backend Minecraft servers, so I'm not sure why another layer would be involved.

itzg avatar Dec 29 '22 19:12 itzg

Can you clarify the use case such as with a simple network diagram? mc-router already has the option to originate PROXY to the backend Minecraft servers, so I'm not sure why another layer would be involved.

Currently mc-router seems to support the following: image

Where the enduser's IP address gets sent to the backend server using PROXY protocol.

My usecase however, is that I'd like to add a reverse proxy to the mix for DDoS mitigation purposes, which turns the diagram into this: image

The problem here is that the reverse proxy sends PROXY protocol already and mc-router isn't able to decipher this as it is expecting a Minecraft handshake instead of PROXY protocol. I'd need mc-router to recognize PROXY protocol coming from an inbound connection and pass these headers through.

clrxbl avatar Dec 29 '22 19:12 clrxbl

Thanks for clarifying. That totally makes sense.

Does it seem to be reasonable to have that be an instance wide argument like --pass-thru-proxy?

itzg avatar Dec 29 '22 22:12 itzg

Thanks for clarifying. That totally makes sense.

Does it seem to be reasonable to have that be an instance wide argument like --pass-thru-proxy?

Yeah, that's fine.

clrxbl avatar Dec 29 '22 23:12 clrxbl

I would also love to see this feature. I use minimum a LB with proxy protocol in front of mc-router. Currently mc-router and the backend Minecraft server do not get the actual client IP.

maltechx avatar Mar 05 '23 10:03 maltechx