Skip to content

Commit fd93117

Browse files
authored
Fix: Propagate authentication headers to HLS initialization segments (EXT-X-MAP) (#241)
fix: propagate rp_ headers to request headers for init segment downloads
1 parent 9744617 commit fd93117

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

mediaflow_proxy/mpd_processor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,10 @@ def build_hls_playlist(
603603
if query_params.get("api_password"):
604604
init_query_params["api_password"] = query_params["api_password"]
605605

606+
for k, v in query_params.items():
607+
if k.startswith('rp_') or k.startswith('h_'):
608+
init_query_params[k] = v
609+
606610
init_map_url = encode_mediaflow_proxy_url(
607611
init_proxy_url,
608612
query_params=init_query_params,

mediaflow_proxy/utils/http_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,10 @@ def get_proxy_headers(request: Request) -> ProxyRequestHeaders:
754754
# Filter out empty values
755755
propagate_headers = {k[3:].lower(): v for k, v in request.query_params.items() if k.lower().startswith("rp_") and v}
756756

757+
for k, v in propagate_headers.items():
758+
if k not in request_headers:
759+
request_headers[k] = v
760+
757761
# Parse headers to remove from response (x_headers parameter)
758762
x_headers_param = request.query_params.get("x_headers", "")
759763
remove_headers = [h.strip().lower() for h in x_headers_param.split(",") if h.strip()] if x_headers_param else []

0 commit comments

Comments
 (0)