bosagora / agora

POC Node implementation for CoinNet
https://bosagora.io
MIT License
36 stars 22 forks source link

BanManager is incompatible with reverse-proxying and load balancing #1675

Open Geod24 opened 3 years ago

Geod24 commented 3 years ago

If someone wished to setup a reverse proxy in front of Agora, it would probably come crashing as soon as the BanManager would be involved, as it would end up banning the proxy. I suggest that we had a (configured) whitelist (we need a whitelisting mechanism for #1674 anyways) and handle https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For and https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded correctly.

mkykadir commented 2 years ago

Suggested header fields are only for HTTP, since we're moving towards to a RPC (and DNS on registry) based communication those fields still would not be enough. There is a newer protocol called Proxy Protocol that we can start to support. This protocol will still work with HTTP communications since it covers TCP communication basically.

In addition to that, we should provide a documentation about putting Agora behind a proxy to aid users about some configuration fields.

mkykadir commented 2 years ago

PR #2863 implements a solution for RPC connections inside Agora. Since we have a HTTP interface available also this needs to be addressed first, because we're using HTTP interface through generated REST API. If this also gets addressed, solution within RPC is not needed.