icecast and apache on the same port (mod_proxy, mod_rewrite)

I have an icecast server running on port 8000. I can access the server fine as LINK1 (see below) from the internet. In addition, I created a small HTML page with some info that also embeds the HTML5 audio player. Works fine if accessed as http host dot domain dot com.

<html>
    <head>
        <title>Radio</title>
    </head>
    <body>
        <p>Some text</p>
        <audio controls>
          <source src="LINK1" type="audio/ogg">
        </audio>
    </body>
</html>

The problem is that if port 8000 is blocked on the listeners computer, they can't hear the stream. So, I tried to use mod_proxy and mod_rewrite but with no avail. If I use the below config, I can bypass the port 8000 and it streams fine on port 80, but http host dot domain dot com shows only the audio player, not the whole HTML page. I tried different combinations and googling and I just can't figure it out.

My question is if this is a viable solution. Having Apache on 80 and icecast 8000 proxying thru the same port? Do I need two IPs maybe? What is the proper config then if I use two IPs. Here is my Apache virtual host config.

ProxyRequests Off
ProxyPass / LINK1
ProxyPassReverse / LINK1
#RewriteEngine On
#RewriteRule ^/mount\.ogg$ LINK2 [P]

Mind that mount.ogg is a non-existing file. It's just a mount point for icecast.

==>Posting links here (need at least 10 reputation) LINK1: http://host.domain.com:8000/mount.ogg LINK2: http://host.domain.com/mount.ogg

Thanks


I didn't want to have to choose between Icecast running on port 80 and all my Apache virtual hosts, running also on port 80, on my sole external IP address.

I didn't want either to open port 8000 on my firewall because I wanted all users being able to reach Icecast even the ones behind enterprise firewalls.

So I managed to run Apache 2.2 listening on port 80 and Icecast 2.4.1 listening on port 8000 on the same host.

I added a new virtual host radio.domain.com (listening on port 80) which is routing the Icecast traffic to/from the local Icecast server (listening on port 8000):

<VirtualHost *:80>
    ServerName radio.domain.com
    ServerAdmin [email protected]
    ProxyPreserveHost On
    ProxyPass / http://localhost:8000/
    ProxyPassReverse / http://localhost:8000/
</VirtualHost>

I was then able to connect audio clients like VLC/Winamp to Icecast mount points using addresses like http://radio.domain.com/my_stream.

However, when connecting to the Icecast virtual host http://radio.domain.com/ web page, the m3u and the xspf files where still exposing the URL http://radio.domain.com:8000/my_stream with that annoying port 8000. Then people downloading those files weren't able to connect to the Icecast server because they were trying to connect on the wrong port. The same was occuring with the YP updates on dir.xiph.org.

I then downloaded the Icecast 2.4.1 source code, and modified it to add a new option:

<exposed-port>80</exposed-port>

You can find that patch on https://damiengarrido.wordpress.com/2015/03/22/icecast-reachable-behind-reverse-proxy/

I can paste the patch in here if needed.