PocketRelay / Client

Client for connecting to Pocket Relay servers
https://pocket-relay.pages.dev/
MIT License
5 stars 3 forks source link

Client-side HTTP #11

Closed jacobtread closed 1 year ago

jacobtread commented 1 year ago

Description

Current implementation of the server forwards http traffic directly to the target server, which works fine for normal servers that don't have any additional layers of security (TLS) however this becomes a problem when users attempt to use a reverse proxy for making their app visible to the internet.

Reverse proxies work perfectly fine with normal game traffic however when it comes to things like GAW (Galaxy At War) and other server resources like Shop Icons for packs, and certain challenge banners the game won't be able to load them (It will still function however the previously mentioned functionality wont work)

Cause

The game is limited because of the "DirtySDK" implementation of SSL which only supports <=SSLv3 which isn't something most reverse proxies are able to support out of the box (Some might not support it at all). This was the same limitation for the original server however this was fixed with the proxying from localhost approach that the server currently uses now.

Solution

Following the same implementation idea that the server currently uses for forwarding the game traffic over the secure http upgrade tunnel the client will locally handle the HTTP requests from the game client that are using SSLv3 and upgrade those connections to the protocol that the reverse proxy is using (TLSv2-3) forwarding on the connection.

Extra notes

The servers will need an additional check when upgrading the initial main connection in order to tell whether it should be forwarding the HTTP connections directly to itself (Current implementation) or if it should forward them locally (New implementation). This can be achieved using an additional client-sent header likely something along the lines of X-Pocket-Relay-Local-Http: true

Checklist