3

I have an Icecast server sitting behind the Apache proxy server, so the connection from the client to Icecast is done by that way:
Client -> Apache server (reverse proxy) -> Icecast server.
The reason I need the proxy, is that I need to have the urls to Icecast via HTTPS on the website, and did not find any other solution except proxying HTTPS to the port, which Icecast sitting on, via HTTP (the proposed solution is here - Why Icecast2 does not want to give the stream through https? , although there they have nginx server as proxy).

Icecast server is showing the stats - the remote ip of the clients connecting to it - and I need that stats. The stats can be viewed via the web-interface of Icecast - base url, following (/admin/listclients.xsl?mount=/mount-point-name). But after proxying the connection, Icecast shows the wrong remote ip there (it always shows the proxy server ip).

Is it possible to make Icecast show the right client ip in those stats (like put there X-Forwarded-For IP instead of REMOTE_ADDR, as the client ip is supposed to be transferred in X-Forwarded-For header to Icecast server by the Apache mod_proxy)?

Here is the config of my Apache proxy virtual host:

<VirtualHost *:443>

    ServerName my-proxy-server.name

    ProxyPreserveHost On
    ProxyRequests Off
    ProxyPass / http://icecast-server-name:8000/
    ProxyPassReverse / http://icecast-server-name:8000/

    # Some other strings related to SSL-certificate
    .....

</VirtualHost>

Apache version: 2.4.7 (on Ubuntu)
Icecast version: 2.4.2

Community
  • 1
  • 1
Alexey Timokhin
  • 818
  • 9
  • 23
  • 1
    1. Try using icecast-kh version 2. Not sure about Apache, but I had it working on Nginx with the following config: `server { listen 80; server_name radio.com; .... location /stream { proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://stream.radio.com:8000/mount; } .... }` (pay attention to `X-Forwarded-For` header) – Alex Paramonov Jun 30 '16 at 13:34
  • @AlexParamonov did you managed to find a solution that works with Apache? I am currently struggling with this. – mr.d Feb 07 '21 at 06:03

3 Answers3

2

I have faced this problem again and here is how I got it working with Nginx & Icecast-kh:

  1. Add X-Forwarded-For header to you Nginx proxy configuration:

    location /stream {
      proxy_set_header X-Forwarded-For $remote_addr; 
      proxy_pass http://stream.radio.com:8000/mount; } 
    }
    
  2. Add <x-forwarded-for>127.0.0.1</x-forwarded-for> to your Icecast configuration somewhere between <paths> tags, where 127.0.0.1 is the IP of your proxy (usually 127.0.0.1)

Alex Paramonov
  • 2,630
  • 2
  • 23
  • 27
1

Icecast currently does not support reverse proxying (and this is not just about the proxy header, there are other issues). We are considering to add full support in 2.5.

We highly recommend to run Icecast directly on port 80. In case of Debian you'll need to configure some things: http://lists.xiph.org/pipermail/icecast/2015-February/013198.html

TBR
  • 2,790
  • 1
  • 12
  • 22
0

I just created repository that contains support of x-forward-ip from kh branch on top of the 2.4.4 version of Icecast. Which could be used until version 2.5.0 is released.