Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for CF-Connecting-IP and decreased timeout #544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

skiby7
Copy link

@skiby7 skiby7 commented Nov 24, 2022

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).
dxlliv added a commit to dxlliv/snapshare that referenced this pull request May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant