From 041891dc9acdfb94cfc08298f9490fef6b540535 Mon Sep 17 00:00:00 2001 From: irl Date: Mon, 5 May 2025 11:20:20 +0100 Subject: [PATCH] fix: always rewrite redirects regardless of content-type --- src/lua/header_filter.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lua/header_filter.lua b/src/lua/header_filter.lua index 7c91bcc..5c27431 100644 --- a/src/lua/header_filter.lua +++ b/src/lua/header_filter.lua @@ -15,13 +15,12 @@ if ngx.header["Content-Type"] then content_type:find("application/vnd.mpegurl") or content_type:find("application/x-mpegurl") then ngx.ctx.rewriting = true - ngx.header["Content-Length"] = nil + ngx.header["Content-Length"] = nil -- We're rewriting the body so this has the wrong value if set end end if ngx.header["Location"] then - local pool_map = ngx.ctx.jasima_pool_map - if ngx.ctx.rewriting and pool_map then + if ngx.ctx.jasima_pool_map then local location = ngx.header["Location"] ngx.header["Location"] = location:gsub("//([a-zA-Z0-9%.%-]+%.[a-zA-Z0-9]+)/", utils.get_mirror) end