How to deal with proxying shoutcast / ICY protocol

From: David Young <david#prophecy.net.nz>
Date: Thu, 10 Mar 2011 15:36:11 +1300


Hi folks,

First-time poster here - we've been working on implementing haproxy to perform load balancing between our backend squid proxies.

I stumbled across an issue today when I realized that I can't listen to streaming radio via my haproxy instance, but that it works fine if I direct my request to one of by backend proxies directly.

A bit of searching lead me to the issue of HTTP/1.1 vs ICY as the probable cause
(http://www.squid-cache.org/Versions/v3/3.1/RELEASENOTES.html#ss2.10).

I thought that if I configured haproxy in "mode tcp" instead of "mode http", that it'd behave more like a simple loadbalancer, and just pass the request onto my squid backend verbatim, but that doesn't seem to have worked either.

An example URL I'm having trouble with is http://66.225.205.47/;stream.mp3

Even in "mode tcp", if I request that URL through by browser from haproxy, I get a 502 error, whereas if I requested it directly from the backend squid instance which services my request anyway, I get the expected headers and stream.

I thought I'd try telnetting to the haproxy / squid ports respectively, to test, and I received differing output (below).

Can anybody enlighten me?

Many thanks,
David

#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global

    log         127.0.0.1 local2
    log         /dev/log local2
    chroot      /var/lib/haproxy
    pidfile     /var/run/haproxy.pid
    maxconn     4000
    user        haproxy
    group       haproxy

    daemon

#---------------------------------------------------------------------

# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block

#---------------------------------------------------------------------
defaults mode http log global option dontlognull option http-server-close option httplog # Log on start of connection, not completion option logasap # log errors separately option log-separate-errors option forwardfor option redispatch

    timeout connect 10000 # default 10 second time out if a backend is not found

    timeout client 300000
    timeout server 300000

    maxconn     60000
    retries     3



#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend test_frontend *:5001

    mode tcp
option tcpka
default_backend test_backend

backend test_backend

        balance roundrobin
        server localhost localhost:3128



DavidBook:~ davidy$ telnet webscan-dev.blahblah.net 5001 Trying x.x.x.x...
Connected to webscan-dev.blahblah.net.
Escape character is '^]'.
GET http://66.225.205.47/;stream.mp3
HTTP/1.0 502 Bad Gateway
Cache-Control: no-cache
Connection: close
Content-Type: text/html

<html><body><h1>502 Bad Gateway</h1>
The server returned an invalid or incomplete response. </body></html>
Connection closed by foreign host.
DavidBook:~ davidy$

DavidBook:~ davidy$ telnet webscan-dev.blahblah.net 3128 Trying x.x.x.x...
Connected to webscan-dev.blahblah.net.
Escape character is '^]'.
GET http://66.225.205.47/;stream.mp3
ICY 200 OK
Date: Thu, 10 Mar 2011 02:25:55 GMT
icy-notice1: <BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>

icy-notice2: SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>
icy-name: Family Friendly WBGL
icy-genre: Contemporary Christian
icy-url: http://www.wbgl.org

Content-Type: audio/mpeg
icy-pub: 1
icy-br: 96
X-Cache: MISS from webscan-dev.blahblah.net X-Cache-Lookup: MISS from webscan-dev.blahblah.net:3128 Via: 0.0 webscan-dev.blahblah.net (squid/3.1.11) Connection: close

00/Ȯt?????sƸD?,?4A?Q`F??BA????B??@(???u??kTC??????? <binary stream continues...> Received on 2011/03/10 03:36

This archive was generated by hypermail 2.2.0 : 2011/03/10 03:45 CET