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