受信リクエストが一致した場合
- Expression Editorに次の式を入力します:
not http.host in {"m.example.com"} and (http.user_agent contains "mobi" or http.user_agent contains "Mobi")
次に
- Type: Static
- URL:
m.example.com - Status code: 301
モバイルデバイスを使用している訪問者を別のホスト名にリダイレクトするルールを作成します。
以下の例では、モバイルデバイスを使用している訪問者をリクエストのユーザーエージェント文字列に基づいて、別のホスト名にリダイレクトします。
この例の静的リダイレクトは、モバイルユーザーからの現在のゾーン(example.com)へのリクエストを、URIパスを保持せずにm.example.comにリダイレクトします。
受信リクエストが一致した場合
not http.host in {"m.example.com"} and (http.user_agent contains "mobi" or http.user_agent contains "Mobi")次に
m.example.comこの例に関する注意事項:
not http.host in {"m.example.com"}条件はリダイレクトループを防ぎます。http.host条件に入力したものと同じである必要があります。この例の単一リダイレクトは、モバイルユーザーからの現在のゾーン(example.com)へのリクエストを、元のHTTPリクエストのURIパスを保持しながらm.example.comにリダイレクトします。
受信リクエストが一致した場合
not http.host in {"m.example.com"} and (http.user_agent contains "mobi" or http.user_agent contains "Mobi")次に
concat("https://m.example.com", http.request.uri.path)この例に関する注意事項:
not http.host in {"m.example.com"}条件はリダイレクトループを防ぎます。http.host条件に入力したものと同じである必要があります。