[Icecast-dev] [PATCH] Use X-Forwarded-For in logs and in listclients

Odin Omdal Hørthe odin.omdal at gmail.com
Sat Oct 9 16:51:31 PDT 2010


In order to show the real ip of proxied clients, I have written a
small patch that fetches and uses X-Forwarded-For instead of IP when
it exists.

Quite obviously this should only be enabled when you know you have a
proxy in front of you.

I haven't looked at how to make configuration options, this first
version[1] is only for enabling that function.


There are different ways this could be used in configuration. Either
as "if IP is this (e.g. <127.0.0.1>)" then look for X-Forwarded-For.
Or just a; "use this header, instead of IP" where you can write either
X-Forwarded-For, or X-Real-IP.

The problem with X-Forwarded-For is that it can be a list, and that
would probably break scripts which only expect one IP. So, on my
server I have actually changed it to X-Real-IP, because I have nginx
sending that out. However, X-Forwarded-For is more normal in default
systems, so I used that in the patch.

Now it's on the internet in case anyone ever searches for this and needs it.


I would be happy to do further work on the patch so that it could be
applied to Icecast.


[1] Well, second, the first version changed admin.c to use the more
sensible if-codes like logger.c. But combining refactoring/cleanup and
function in one patch is not correct.

-- 
Beste helsing,
Odin Hørthe Omdal <odin.omdal at gmail.com>
http://velmont.no
-------------- next part --------------
A non-text attachment was scrubbed...
Name: icecast_use_x-forwarded-for_v2.patch
Type: text/x-patch
Size: 2032 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/icecast-dev/attachments/20101010/f61321ac/attachment.bin 


More information about the Icecast-dev mailing list