savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.4k stars 130 forks source link

Implement proxy protocol #4186

Open vitoyucepi opened 2 days ago

vitoyucepi commented 2 days ago

Description

I'd like to see support for the proxy protocol in liquidsoap for various inputs and harbors. It preserves client IP when working behind the reverse proxy. It's possible to use the http headers x-forwarded-for and x-real-ip for HTTP, but for TCP streams, like Icy, it's never been an option.

Preferable solution

Add an option to switch the port into proxy mode.

Alternative solutions

No response

Additional context

I don't know the origin of the proxy protocol, but it seems the haproxy developed it.

The promotional post in the haproxy blog about it is available here: https://www.haproxy.com/blog/use-the-proxy-protocol-to-preserve-a-clients-ip-address. The specification can be found here: https://github.com/haproxy/haproxy/blob/master/doc/proxy-protocol.txt.

toots commented 2 days ago

Thanks! Do you mean that you would like liquidsoap to be able to act as a proxy?

vitoyucepi commented 2 days ago

liquidsoap to be able to act as a proxy?

I'd like to put it behind haproxy, nginx, or another reverse proxy server that will terminate the encryption but still preserve the external IP address.