Introduction

Modify header of HTTP request/response based on defined rules.

Configuration

  • Module config file

    conf/mod_header/mod_header.conf

    1. [basic]
    2. DataPath = ../conf/mod_header/header_rule.data
  • Rule config file

    conf/mod_header/header_rule.data

    | Config Item | Type | Description || —————- | ——— | —————————————————————————————— || Version | String | Verson of config file || Config | Struct | Header rules for each product. Header rule include: - Cond: “condition” expression - Actions: what to do after matched- Last: if true, stop to check the remaining rules |

    | Action | Description || ——————— | ——————————— || REQ_HEADER_SET | Set request header || REQ_HEADER_ADD | Add request header || RSP_HEADER_SET | Set response header || RSP_HEADER_ADD | Add response header || REQ_HEADER_DEL | Delete request header || RSP_HEADER_DEL | Delete response header || REQ_HEADER_MOD | Modify request header || RSP_HEADER_MOD | Modify response header |

    1. {
    2. "Version": "20190101000000",
    3. "Config": {
    4. "example_product": [
    5. {
    6. "cond": "req_path_prefix_in(\"/header\", false)",
    7. "actions": [
    8. {
    9. "cmd": "RSP_HEADER_SET",
    10. "params": [
    11. "X-Proxied-By",
    12. "bfe"
    13. ]
    14. }
    15. ],
    16. "last": true
    17. }
    18. ]
    19. }
    20. }