Introduction

Redirect HTTP request based on defined rules.

Configuration

  • Module config file

    conf/mod_redirect/mod_redirect.conf

    1. [basic]
    2. DataPath = ../conf/mod_redirect/redirect.data
  • Rule config file

    conf/mod_redirect/redirect.data

    | Config Item | Type | Description || —————- | ——— | —————————————————————————————— || Version | String | Verson of config file || Config | Struct | Redirect rules for each product. Redirect rule include: - Cond: “condition” expression - Actions: what to do after matched- Status: response status code |

    | Action | Description || ——————— | —————————————————————————————————————————- || URL_SET | redirect to specified URL || URL_FROM_QUERY | redirect to URL parsed from specified query in request || URL_PREFIX_ADD | redirect to URL concatenated by specified prefix and the original URL || SCHEME_SET | redirect to the original URL but with scheme changed. supported scheme: http|https |

    1. {
    2. "Version": "20190101000000",
    3. "Config": {
    4. "example_product": [
    5. {
    6. "Cond": "req_path_prefix_in(\"/redirect\", false)",
    7. "Actions": [
    8. {
    9. "Cmd": "URL_SET",
    10. "Params": ["https://example.org"]
    11. }
    12. ],
    13. "Status": 301
    14. }
    15. ]
    16. }
    17. }