Skip to content

[MITM] HTTPS Decryption ​

This section configures certificate credentials and target host scopes for HTTPS traffic decryption (Man-in-the-Middle).

Undecrypted HTTPS traffic exposes only TLS SNI domain information. HTTP processing features in URL Rewrite, Header Rewrite, Response, and Script require decrypted plaintext HTTP messages to take effect.

Operational Requirements & Constraints ​

Enabling MITM requires meeting the following conditions and constraints:

  • Root Certificate Trust: Client devices must install the configured CA root certificate into the system trust store; otherwise, TLS handshakes will fail verification.
  • Certificate Issuance: Upon intercepting a TLS handshake, the proxy dynamically generates a host certificate for the target domain using the CA credentials to handshake with the client, while establishing a secure TLS connection with the target server.
  • Certificate Pinning and Exemption: Applications utilizing Certificate Pinning must have their domains added to skip-hostname to pass raw TLS traffic directly.

Field Reference ​

This section uses key-value configuration directives:

  • hostname (List of host patterns, comma-separated or [item1, item2], default empty list) Target hosts enabled for HTTPS decryption. Supports * and ? wildcards (e.g., *.example.com, api-?.example.com), defaults to port 443, and supports explicit ports (e.g., example.com:8443) or :0 to match any port. Also supports - exclusion prefixes (e.g., -internal.example.com), evaluated in declaration order (first match wins); only hosts matching this list are decrypted. Supports key-level %APPEND% / %INSERT% list merging with Plugin.

    ini
    hostname = api.example.com, *.web.example.com, app.example.com:8443
  • skip-hostname (List of host patterns, comma-separated or [item1, item2], default empty list) Exclusion list of hosts exempt from decryption. Supports * and ? wildcards, explicit ports (default 443), and :0 for any port. Automatically prepended at the highest priority as inverse rules, taking precedence over hostname; matching hosts pass raw TLS traffic through directly. Supports key-level %APPEND% / %INSERT% list merging with Plugin.

    ini
    skip-hostname = *.apple.com, *.icloud.com, secure.payment.example.com
  • ca-keystore-name (Keystore name, unset) Retrieves the p12 archive by name from Keychain or Keystore (must be a non-empty string with no NUL characters and at most 255 UTF-8 bytes), taking precedence over direct ca-p12 / ca-passphrase fields. If retrieval or validation fails, MITM is disabled without falling back to direct fields. The decryption passphrase is provided by Keystore. Overwritten as a scalar during plugin merging.

    ini
    ca-keystore-name = ca-cert
  • ca-p12 (Base64-encoded string, unset) Root CA certificate and private key archive in PKCS#12 (.p12 / .pfx) format, Base64-encoded; overwritten as a scalar during plugin merging. A bare empty value (ca-p12 =) is treated as unset; wrap in double quotes if the value contains spaces, commas, quotes, or inline comment triggers (whitespace followed by # / ;).

    ini
    ca-p12 = <BASE64_CERT_DATA>
  • ca-passphrase (String, unset) Password required to unlock the PKCS#12 archive; overwritten as a scalar during plugin merging. A bare empty value (ca-passphrase =) parses as unset (unlocked with an empty passphrase at runtime), whereas ca-passphrase = "" parses as an explicit empty string. Wrap in double quotes if the passphrase contains spaces, commas, inline comment triggers (whitespace followed by # / ;), newlines, or quotes (escaping internal " and \ as \" and \\).

    ini
    ca-passphrase = "<SECRET>"

Activation Conditions & Processing Flow ​

  1. Trigger Conditions: HTTPS decryption activates only when three conditions are met simultaneously: valid CA materials and passwords are configured via ca-keystore-name or ca-p12; the client operating system trusts the CA root certificate; and the SNI hostname and port of the request match hostname.
  2. Evaluation Precedence: For incoming HTTPS sessions, the system checks skip-hostname first. If matched, raw TCP traffic passes through untouched. It then evaluates hostname (including - exclusion entries) in order; decryption is initiated only when not excluded and matched by an allow entry.
  3. Undecrypted Traffic Handling: Sessions that are not decrypted or explicitly excluded can only be routed using transport-layer and domain-based rules in Rule (such as DOMAIN, DOMAIN-SUFFIX, IP-CIDR). Subsequent HTTP rules will skip these sessions.

Configuration Examples ​

ini
[Keystore]
ca-cert = p12, base64=<BASE64_CERT_DATA>, password="<SECRET>"

[MITM]
hostname = api.example.com, *.web.example.com, *.example.com:8443
skip-hostname = *.apple.com, *.icloud.com, secure.payment.example.com
ca-keystore-name = ca-cert

2. Inline PKCS#12 Credentials ​

ini
[MITM]
hostname = [api.example.com, *.web.example.com]
skip-hostname = *.apple.com, *.icloud.com, secure.payment.example.com
ca-p12 = <BASE64_CERT_DATA>
ca-passphrase = "<SECRET>"