[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-hostnameto 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 port443, and supports explicit ports (e.g.,example.com:8443) or:0to 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.inihostname = api.example.com, *.web.example.com, app.example.com:8443skip-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 (default443), and:0for any port. Automatically prepended at the highest priority as inverse rules, taking precedence overhostname; matching hosts pass raw TLS traffic through directly. Supports key-level%APPEND%/%INSERT%list merging with Plugin.iniskip-hostname = *.apple.com, *.icloud.com, secure.payment.example.comca-keystore-name(Keystore name, unset) Retrieves thep12archive 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 directca-p12/ca-passphrasefields. 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.inica-keystore-name = ca-certca-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#/;).inica-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), whereasca-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\\).inica-passphrase = "<SECRET>"
Activation Conditions & Processing Flow
- Trigger Conditions: HTTPS decryption activates only when three conditions are met simultaneously: valid CA materials and passwords are configured via
ca-keystore-nameorca-p12; the client operating system trusts the CA root certificate; and the SNI hostname and port of the request matchhostname. - Evaluation Precedence: For incoming HTTPS sessions, the system checks
skip-hostnamefirst. If matched, raw TCP traffic passes through untouched. It then evaluateshostname(including-exclusion entries) in order; decryption is initiated only when not excluded and matched by an allow entry. - 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
1. Using Keystore / Keychain Credentials (Recommended)
[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-cert2. Inline PKCS#12 Credentials
[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>"