Project: BFE (Orchestration & Management / Service Proxy)
File: mod_header.md

mod_header modifies header of HTTP request/response based on defined rules. conf/modheader/modheader.conf | Config Item | Description | | -- | | | Basic.DataPath | String<br>Path of rule configuration | | Log.OpenDebug | Boolean<br>Debug flag of module | ```ini [Basic] DataPath = modheader/headerrule.data ``` conf/modheader/headerrule.data | Config Item | Description | | -- | | | Version | String<br>Version of config file | | Config | Struct<br>Header rules for each product | | Config{k} | String<br>Product name | | Config{v} | Object<br>A ordered list of rules | | Config{v}[] | Object<br>A rule | | Config{v} | | Config{v}[].Last | Boolean<br>If true, stop processing the next rule | | Config{v}[].Actions | Object<br>A list of Actions | | Config{v}[].Actions.Cmd | String<br>A Action | | Config{v}[].Actions.Params | Object<br>A list of parameters for action | | Config{v}[].Actions.Params[] | String<br>A parameter | | Action | Description | Parameters | | -- | - | - | | REQHEADERSET | Set request header | HeaderName, HeaderValue | | REQHEADERADD | Add request header | HeaderName, HeaderValue | | REQHEADERDEL | Delete request header | HeaderName | | RSPHEADERSET | Set response header | HeaderName, HeaderValue | | RSPHEADERADD | Add response header | HeaderName, HeaderValue | | RSPHEADERDEL | Delete response header | HeaderName | ```json { "Version": "20190101000000", "Config": { "example_product": [ { "cond": "reqpathprefix_in(\"/header\", false)", "actions": [ { "cmd": "REQHEADERSET", "params": [ "X-Bfe-Log-Id", "%bfelogid" ] }, { "cmd": "REQHEADERSET", "params": [ "X-Bfe-Vip", "%bfe_vip" ] }, { "cmd": "RSPHEADERSET", "params": [ "X-Proxied-By", "bfe" ] } ], "last": true } ] } } ``` BFE provides a list of variables which are evaluated in the runtime during the processing of each request. See the Example above. | Variable | Description | | -- | -- | | %bfeclientip | Client IP | | %bfeclientport | Client port | | %bferequesthost | Value of Request Host header | | %bfesessionid | Session ID | | %bfelogid | Request ID | | %bfe_cip | Client IP (CIP) | | %bfe_vip | Virtual IP (VIP) | | %bfeservername | BFE instance address | | %bfe_cluster | Backend cluster | | %bfebackendinfo | Backend information | | %bfesslresume | Whether the TLS/SSL session is resumed with session id or session ticket | | %bfesslcipher | TLS/SSL cipher suite | | %bfesslversion | TLS/SSL version | | %bfesslja3_raw | JA3 fingerprint string for TLS/SSL client | | %bfesslja3_hash | JA3 fingerprint hash for TLS/SSL client | | %bfehttp2fingerprint | HTTP/2 fingerprint | | %bfe_protocol | Application level protocol | | %clientcertserial_number | Serial number of client certificate | | %clientcertsubject_title | Subject title of client certificate | | %clientcertsubjectcommonname | Subject Common Name of client certificate| | %clientcertsubject_organization | Subject Organization of client certificate | | %clientcertsubjectorganizationalunit | Subject Organizational Unit of client certificate | | %clientcertsubject_province | Subject Province of client certificate | | %clientcertsubject_country | Subject Country of client certificate | | %clientcertsubject_locality | Subject Locality of client certificate |