fix: check for config before rewriting

This commit is contained in:
Iain Learmonth 2025-05-17 16:09:42 +01:00
parent b7cf5a5084
commit 5fe0739635
2 changed files with 42 additions and 38 deletions

View file

@ -52,6 +52,7 @@ local function rewrite_body(body)
return body
end
if ngx.ctx.jasima_config then
if ngx.ctx.rewriting then
local chunk = ngx.arg[1]
local eof = ngx.arg[2]
@ -71,3 +72,4 @@ if ngx.ctx.rewriting then
ngx.arg[1] = nil
end
end
end

View file

@ -1,5 +1,6 @@
local utils = require "utils"
if ngx.ctx.jasima_config then
if ngx.ctx.jasima_config.rewrite_disable then
return
end
@ -27,3 +28,4 @@ if ngx.header["Location"] then
ngx.header["Location"] = location:gsub("//([%a%d%.-]+%.[%a%d-]+)/+", utils.get_mirror)
end
end
end