When hosting Snapdrop behind Cloudflare, X-Forwarded-For is useless. Furthermore, I'm hosting my installation behind another internal proxy, so, in the end, X-Forwarder-For is set to the internal proxy's IP for all the peer, which can see each other regardless being on different networks. To fix this I made _setIP check if the header "cf-connecting-ip" exists, then sets the IP accordingly.
Lastly, when a peer changes network (e.g. a phone switches from wifi to mobile data), the function _leaveRoom is not called and the peer stays visible to others connected to the same room for a whole minute: I adjusted the timeout to what I think is a more reasonable value (500ms, so _leaveRoom is called after 1s).
When hosting Snapdrop behind Cloudflare,
X-Forwarded-For
is useless. Furthermore, I'm hosting my installation behind another internal proxy, so, in the end,X-Forwarder-For
is set to the internal proxy's IP for all the peer, which can see each other regardless being on different networks. To fix this I made_setIP
check if the header "cf-connecting-ip" exists, then sets the IP accordingly.Lastly, when a peer changes network (e.g. a phone switches from wifi to mobile data), the function
_leaveRoom
is not called and the peer stays visible to others connected to the same room for a whole minute: I adjusted the timeout to what I think is a more reasonable value (500ms, so_leaveRoom
is called after 1s).