メインコンテンツにスキップ

ルール

Rulesは、Siteへの受信リクエストを許可またはブロックするための条件を定義します。各ルールには、タイプ、式のセット、およびアクションがあります。

ルールのプロパティ​

フィールド説明
TypeThe kind of matching to perform (see below).
ExpressionsOne or more conditions to evaluate. All expressions in a rule are evaluated together.
ActionAllow or Block — what to do when the rule matches.
Status codeリクエストがブロックされた場合に返されるHTTPステータスコード(例: 403)。
ReasonMessage included in the blocked response.
詳細モードLog detailed information for each request evaluated by this rule.

ルールのタイプ​

IP​

クライアントのIPアドレスによるリクエストのマッチング。式は以下をサポートします:

演算子説明
is inIP is within a specific CIDR range (e.g. 192.168.0.0/24).
is not inIP is outside a CIDR range.
equalsIP matches exactly.
does not equalIP does not match exactly.
is abroadIP is detected as originating outside the server's country (requires IP geolocation).

複数のIP値は、単一の式内でカンマ区切りで指定できます。

User-Agent​

User-Agentヘッダーによるリクエストのマッチング。式は以下をサポートします:

演算子説明
containsUser-Agent contains the specified string.
does not containUser-Agent does not contain the string.
equalsUser-Agent matches exactly.
does not equalUser-Agent does not match.
matches regexUser-Agent matches a regular expression.
does not match regexUser-Agentが正規表現と一致しません。

IPレート制限​

一定の時間窓内でのIPごとのリクエスト数を制限します。リクエスト制限、時間窓、および制限を超えた場合の応答を設定します。

WAF​

リクエストの内容(ヘッダー、ボディ、クエリパラメータ)に基づいてWeb Application Firewall(WAF)ルールを適用します。SQLインジェクション、XSS、パストラバーサルなどの一般的な攻撃パターンを検出・ブロックするために、modsecurity互換のルール構文を使用します。

複合​

複数のサブルール(任意のタイプ)を単一のルールに結合します。複合ルールは、すべてのサブルール条件が同時に満たされた場合に一致します。

サイトへのルールの添付​

ルールは Site の編集ページに添付されます。ルールはリストされた順序で評価され、最初に一致した時点で評価が停止します。ルールリストの矢印を使用してルールの順序を変更できます。

ヒント

開発中は Verbose mode を使用して、ルールの評価詳細をログに記録し、本番環境で有効にする前に式を調整してください。