speedtest icon indicating copy to clipboard operation
speedtest copied to clipboard

IP from Reverse Proxy is being written into stats db instead of client IP

Open totti4ever opened this issue 5 years ago • 5 comments

The client IP apparently is being correctly feteched (#100) and also echoed, but the db column ip always holds the reverse proxy's ip

totti4ever avatar Apr 23 '20 11:04 totti4ever

Yes, that's how it's telemetry.php is implemented. The output of getIP is also stored alongside it, so you'll have both.

adolfintel avatar Apr 23 '20 12:04 adolfintel

So that's how you still would and want to do it? Or is it that you cannot afford the time to change it, then I could check and make a PR.

To me it doesn't make any sense to store the reverse proxy's IP in every single column again and again and the ISPinfo column is a mixed text column, which is hard to interpret from a technical point of view.

totti4ever avatar Apr 23 '20 12:04 totti4ever

It's just a remnant from an older version, I never got around to changing it because it never bothered anyone before. Ideally we could move the IP detection code from getIP.php into a file that's included by both getIP.php and telemetry.php, so that they use the same exact code and report the same value. What do you think?

adolfintel avatar Apr 23 '20 14:04 adolfintel

Hey, sound reasonable, yes. At least that's what I would make it like in pseudo code. Although the name getIP might be the better for the common code and the additional code for the "proccessed IP" might be better in a file like processIP.php or so?

But I am no native coder, so other ideas might weight more.

totti4ever avatar Apr 23 '20 18:04 totti4ever

This issue has been resolved by #457

bierpub avatar Jan 10 '22 02:01 bierpub