一分钟搭建影视站,支持Docker等部署方式
fix: 增加日志记录以改善URL解码和错误处理
developer2f023a6ad0c3
diff --git a/proxy.lua b/proxy.luaindex b15fa0c..cd3726c 100644--- a/proxy.lua+++ b/proxy.lua@@ -1,6 +1,8 @@-- 解码URL函数local function decode_uri(uri)+ ngx.log(ngx.DEBUG, "decode_uri 输入: ", uri)local decoded = ngx.unescape_uri(uri)+ ngx.log(ngx.DEBUG, "decode_uri 输出: ", decoded)return decodedend@@ -13,6 +15,7 @@ local _, _, target_path = string.find(request_uri, "^/proxy/(.*)")ngx.log(ngx.DEBUG, "提取的目标路径: ", target_path or "nil")if not target_path or target_path == "" then+ ngx.log(ngx.ERR, "未提供目标URL,返回400")ngx.status = 400ngx.say("错误: 未提供目标URL")return ngx.exit(400)@@ -23,6 +26,7 @@ local target_url = decode_uri(target_path)ngx.log(ngx.DEBUG, "解码后的目标URL: ", target_url)if not target_url or target_url == "" then+ ngx.log(ngx.ERR, "无法解析目标URL,返回400")ngx.status = 400ngx.say("错误: 无法解析目标URL")return ngx.exit(400)@@ -34,5 +38,7 @@ ngx.log(ngx.STDERR, "代理请求: ", target_url)-- 设置目标URL变量供Nginx使用ngx.var.target_url = target_url+ngx.log(ngx.DEBUG, "已设置 ngx.var.target_url: ", ngx.var.target_url)+-- 继续执行Nginx配置的其余部分return\ No newline at end of file