Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleHTTPS - net.http

HTTP uses one-way TLS by default, as the verify_peer and verify_host parameters are set to true.

To use two-way mTLS, you can provide an ssl parameter can be passed as a table of values:

Code Block
languagelua
-- add parameters to ssl table 
local ssl_info = {
   cert=iguana.workingDir()..'configurations/web/cert.pem',
   key=iguana.workingDir()..'configurations/web/key.pem'
}
 
-- pass ssl_info to the net.http ssl parameter    
local r, c, h = net.http.post{
   url='httphttps://localhost:6544/demo', 
   body=Data,
   ssl=ssl_info,
   live=true
}

Below is the full list of available ssl table parameters. See the built-in help documentation in the Translator for additional details:

Parameter

Description

Default

cert

The name of your certificate file.

cert_type

Your certificate's type: PEM or DER.

PEM

key

The name of your private key file.

key_pass

The password to access your private key.

key_type

Your private key's type: PEM, DER, or ENG.

PEM

ssl_engine

The engine to use with 'key_type' ENG.

verify_peer

Ensures that the server's certificate is valid and trusted by verifying it against a CA.

true

verify_host

Ensures that the server's certificate is specifically intended for the hostname you are connecting to.

true

ca_file

The certificate(s) file to use for peer verification.

issuer_cert

The PEM certificate file to validate the issuer of the peer's certificate during peer validation.

crl_file

The name of the certificate revocation list to use during peer validation.

ssl_version

Use a particular SSL version(s). Possible values for ssl_version are tls-v1, tls-v1.1, tls-v1.2, tls-v1.3. See Overriding TLS Defaults.

Tries tls-v1.3 and then tls-v1.2.

cipher_list

Provide a list of ciphers in OpenSSL format to use. See Overriding TLS Defaults.

cipher_suite_list

Provide a list of TLSv1.3 cipher suites in OpenSSL format to use. See Overriding TLS Defaults.

...