fix: replace lua patterns for content type check

This commit is contained in:
Iain Learmonth 2025-05-07 18:33:29 +01:00
parent 0214a278da
commit b7cf5a5084

View file

@ -11,10 +11,11 @@ if ngx.header["Content-Type"] then
content_type:find("text/xml") or content_type:find("text/xml") or
content_type:find("application/javascript") or content_type:find("application/javascript") or
content_type:find("application/json") or content_type:find("application/json") or
content_type:find("application/rss+xml") or content_type:find("application/rss%+xml") or
content_type:find("application/atom+xml") or content_type:find("application/atom%+xml") or
content_type:find("application/vnd.mpegurl") or content_type:find("application/vnd%.mpegurl") or
content_type:find("application/x-mpegurl") then content_type:find("application/x%-mpegurl") then
ngx.log(ngx.DEBUG, "Enabling rewrite due to content type " .. content_type)
ngx.ctx.rewriting = true ngx.ctx.rewriting = true
ngx.header["Content-Length"] = nil -- We're rewriting the body so this has the wrong value if set ngx.header["Content-Length"] = nil -- We're rewriting the body so this has the wrong value if set
end end