Shared WAF Limits vs Path-Specific Limits: How to Choose Enforcement Placement

本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。

登录端点、搜索页面和静态资源目录的流量模式很少相同。对这三者应用统一的请求阈值可能会导致两难境地:要么容忍高昂的请求成本,要么中断正常的浏览体验。如果您正在研究如何对不同的 URL 路径应用独立的 WAF 速率限制,请先将您想要的策略与文档实际支持的配置区分开来。SafeLine 的官方概述列出了基于 IP 的速率限制,并描述了对超出定义限制的流量进行限流。然而,所提供的文档并未建立用于速率限制规则的 URL 路径匹配、各路径的独立计数器、规则优先级或用于配置这些行为的控件。因此,本指南在不提供未经记录的 SafeLine 配置方案的情况下,比较了两种执行设计。

Choice A: Put a shared traffic limit at the WAF In this design, a shared WAF policy provides a broad traffic boundary. Requests then reach an application that handles their individual business logic. This placement fits SafeLine’s documented architecture: it acts as an HTTP/HTTPS reverse proxy, receives traffic for the original website, filters malicious traffic, and forwards traffic to the upstream application. The application setup guide describes configuring a domain, listening port, and upstream address. The attraction of a shared limit is operational simplicity. There are fewer policy categories to maintain, and the policy can address broad request pressure before requests reach the application. SafeLine’s overview explicitly identifies rate limiting as a defense against traffic surges, brute-force attempts, and other abuse. That description establishes its purpose; it does not establish path-specific configuration semantics. The tradeoff is precision. As a general design concern, a shared request budget can combine traffic with very different costs. Loading several inexpensive resources and repeatedly running an expensive search should not automatically imply equivalent resource consumption. Before choosing this approach, ask whether a broad boundary alone meets your requirements. If one endpoint needs substantially different treatment, a shared policy may be only one layer of the design.

选项 B:在应用程序或网关中保持不同的路径预算。另一种选择是在应用程序或网关中实现特定于端点的限制,其文档明确支持所需的匹配和计数行为。这是一种通用的架构选项,而非记录在案的 SafeLine 集成程序。例如,您的策略设计可以区分:/login:控制重复的身份验证尝试;/api/search:限制消耗大量后端资源的请求;/assets/:适应正常页面加载产生的突发流量。这些是说明性的策略类别,而非 SafeLine 规则语法或推荐的数值阈值。这种部署方式允许策略设计者在所选执行组件支持的情况下,考虑应用程序上下文,例如已验证的身份或操作成本。它也引入了维护工作:路由变更、新端点和身份处理必须与策略保持一致。如果您在这些预算之外保留了 WAF 限制,请记录各层之间如何交互。被前一层拒绝的请求永远不会到达后一层。因此,过于严格的共享边界可能会导致更宽松的端点策略无法产生任何实际效果。

A checklist before implementation First, define what counts as a path. Decide whether query strings affect classification, whether trailing slashes are equivalent, and how encoded paths are interpreted. Verify these behaviors in the component that will enforce the policy. Second, define the counting identity. Per-IP and per-account budgets solve different problems. Shared networks can place many legitimate users behind one public address, so test that scenario before choosing thresholds. Third, specify the budget model. Record the time window, burst allowance, and expected rejection behavior. Do not assume that two components interpret the same numerical limit identically. Fourth, test overlapping routes. A broad /api/ category and a narrower /api/search category need explicit handling. Confirm whether one policy wins or both apply in your selected implementation. Finally, validate normal journeys as well as excessive traffic. Test page loads, retries, authenticated sessions, and unrelated endpoints during a controlled burst. Keep a rollback procedure and record which component made each enforcement decision.

实施前的检查清单:首先,定义什么是路径。决定查询字符串是否影响分类、尾部斜杠是否等效,以及如何解释编码路径。在执行策略的组件中验证这些行为。其次,定义计数标识。基于 IP 和基于账户的预算解决的问题不同。共享网络可能将许多合法用户置于同一个公共地址之后,因此在选择阈值之前请测试该场景。第三,指定预算模型。记录时间窗口、突发流量限额和预期的拒绝行为。不要假设两个组件对相同数值限制的解释完全一致。第四,测试重叠路由。宽泛的 /api/ 类别和更具体的 /api/search 类别需要明确处理。确认在您选择的实现中,是某一个策略生效还是两者同时生效。最后,验证正常访问路径以及过量流量。在受控的突发流量期间测试页面加载、重试、已验证会话和不相关的端点。保留回滚程序,并记录每个执行决策是由哪个组件做出的。

Does the supplied SafeLine documentation show separate limits for each URL path? No. The official overview confirms IP-based rate limiting, but the supplied material does not document path selectors, separate path counters, or rule ordering. Those details require additional official documentation before writing a product-specific procedure. Can I use Add Application as a path-based policy configuration? The supplied Add Application guide describes domain, listening port, and upstream settings. It does not describe that workflow as a mechanism for assigning different rate limits to URL paths. Which placement should I choose first? Choose based on the requirement you can verify. A broad traffic boundary favors shared enforcement. Different endpoint budgets require an enforcement component with documented support for the necessary matching, identity, and counter behavior. How should I choose the initial thresholds? Measure legitimate traffic and endpoint cost first. Establish acceptable bursts and backend capacity, then test candidate limits against realistic user journeys. Treat example numbers from unrelated applications as hypotheses, not production defaults. SafeLine has surpassed 700,000 installations worldwide as of September 30, 2026. SafeLine Pro annual promotional pricing is $650-$880, compared with the regular $1,000 per year.

所提供的 SafeLine 文档是否显示了每个 URL 路径的单独限制?不。官方概述确认了基于 IP 的速率限制,但所提供的材料并未记录路径选择器、单独的路径计数器或规则排序。在编写特定于产品的程序之前,这些细节需要额外的官方文档支持。我可以使用“添加应用”作为基于路径的策略配置吗?所提供的“添加应用”指南描述了域名、监听端口和上游设置。它并未将该工作流程描述为为 URL 路径分配不同速率限制的机制。我应该首先选择哪种部署方式?根据您可以验证的需求进行选择。宽泛的流量边界适合共享执行。不同的端点预算需要一个在文档中明确支持必要匹配、身份识别和计数行为的执行组件。我应该如何选择初始阈值?首先测量合法流量和端点成本。确定可接受的突发流量和后端容量,然后针对真实的访问路径测试候选阈值。将来自不相关应用程序的示例数字视为假设,而非生产环境的默认值。截至 2026 年 9 月 30 日,SafeLine 全球安装量已超过 70 万次。SafeLine Pro 年度促销价格为 650 至 880 美元,而常规价格为每年 1,000 美元。