From 394cc28901f7412cde0ae8db65b4ea6d35fddbcd Mon Sep 17 00:00:00 2001 From: Mart van Santen Date: Mon, 20 Jul 2026 19:22:50 +0200 Subject: [PATCH] Behind a proxy, m3u and other playlist do not show the correct protocol / honour the x-forwarded-proto header. This is fixed in this patch. --- src/client.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index 1732a8a6..3bf5fa08 100644 --- a/src/client.c +++ b/src/client.c @@ -1089,6 +1089,7 @@ ssize_t client_get_baseurl(client_t *client, listensocket_t *listensocket, char const listener_t *listener = NULL; const ice_config_t *config = NULL; const char *host = NULL; + const char *forwarded_proto = NULL; const char *proto = "http"; int port = 0; ssize_t ret; @@ -1145,7 +1146,15 @@ ssize_t client_get_baseurl(client_t *client, listensocket_t *listensocket, char case ICECAST_TLSMODE_DISABLED: case ICECAST_TLSMODE_AUTO: switch (protocol) { - case ICECAST_PROTOCOL_HTTP: proto = "http"; break; + case ICECAST_PROTOCOL_HTTP: + proto = "http"; + if (client) { + forwarded_proto = httpp_getvar(client->parser, "x-forwarded-proto"); + if (forwarded_proto && strcmp(forwarded_proto, "https") == 0) { + proto = "https"; + } + } + break; case ICECAST_PROTOCOL_SHOUTCAST: proto = "icy"; break; } break;