karlheyes / icecast-kh

KH branch of icecast
GNU General Public License v2.0
297 stars 105 forks source link

Listener statistic data with cloudflare proxy is not detected real IP #377

Closed gunsar closed 1 year ago

gunsar commented 1 year ago

@karlheyes

i did experiment on linux and windows icecast-kh16 and linux icecast-kh17 then enable proxy from cloudflare in icecast.xml i added ssl data

<ssl-certificate>/etc/icecast-kh/bundle.pem</ssl-certificate>

then i listen using foobar with cloudflare ssl address running normally, but check in /admin.html

List Clients IP : 162.158.170.xx Connected (seconds) : 263 Lag (bytes) : 0 User Agent : foobar2000/1.6.14 Action : Kick

IP : 162.158.170.xx (this is cloudflare IP) not the internet IP that I use. The IP that I use is 182.xx.xx.xx

how do you set it so that the statistics detect the original IP, while still enabling the proxy on cloudflare.

thank's

rrolla commented 1 year ago

@gunsar this should work add to your icecast config your cloudflare ip 162.158.170.xx

<!-- If behind reverse proxy, set here its ip
<x-forwarded-for>162.158.170.xx</x-forwarded-for>

This option is from version 2.3.3-kh1 https://github.com/karlheyes/icecast-kh/blob/master/NEWS#L412

gunsar commented 1 year ago

@rrolla Thank you for your advice. If only 1 cloudflare IP is received (fixed cloudflare IP) it might work fine. The problem is that each listener is confirmed to get a different Cloudflare IP. But I tried to use azuracast and enable Cloudflare proxy, listener IP detected in statistics is their real IP, not Cloudflare IP.