From b7cf5a5084c98071e73dcbf6e0891cb98345af7e Mon Sep 17 00:00:00 2001 From: irl Date: Wed, 7 May 2025 18:33:29 +0100 Subject: [PATCH] fix: replace lua patterns for content type check --- src/lua/header_filter.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lua/header_filter.lua b/src/lua/header_filter.lua index 295d395..d7c3d17 100644 --- a/src/lua/header_filter.lua +++ b/src/lua/header_filter.lua @@ -11,10 +11,11 @@ if ngx.header["Content-Type"] then content_type:find("text/xml") or content_type:find("application/javascript") or content_type:find("application/json") or - content_type:find("application/rss+xml") or - content_type:find("application/atom+xml") or - content_type:find("application/vnd.mpegurl") or - content_type:find("application/x-mpegurl") then + content_type:find("application/rss%+xml") or + content_type:find("application/atom%+xml") or + content_type:find("application/vnd%.mpegurl") or + content_type:find("application/x%-mpegurl") then + ngx.log(ngx.DEBUG, "Enabling rewrite due to content type " .. content_type) ngx.ctx.rewriting = true ngx.header["Content-Length"] = nil -- We're rewriting the body so this has the wrong value if set end