本地地址不允许跳转

This commit is contained in:
大石头 2025-07-27 17:29:51 +08:00
parent 2f96210a70
commit d77cb4e522
1 changed files with 4 additions and 0 deletions

View File

@ -28,6 +28,10 @@ public static class MiddlewareHelper
(u.Host.IsNullOrEmpty() || uri.Host.EqualIgnoreCase(u.Host)) && (u.Host.IsNullOrEmpty() || uri.Host.EqualIgnoreCase(u.Host)) &&
(u.Port == 0 || u.Port == uri.Port)) return false; (u.Port == 0 || u.Port == uri.Port)) return false;
// 本地地址不允许跳转
if (uri.Host.EqualIgnoreCase("localhost", "127.0.0.1")) return false;
if (uri.Host.IsMatch("127.*")) return false;
using var span = DefaultTracer.Instance?.NewSpan("ForceRedirect", uri + ""); using var span = DefaultTracer.Instance?.NewSpan("ForceRedirect", uri + "");
span?.AppendTag($"规则:{set.ForceRedirect}"); span?.AppendTag($"规则:{set.ForceRedirect}");