Mockoon supports serving your mock API over TLS with a self-signed certificate by default. You can also provide your certificate and trusted CA certificates.
You can activate the TLS option for each environment independently. Open the Environment Settings by clicking on the tab at the top of the window:
Enable the TLS option by ticking the checkbox. The option was successfully activated if a yellow lock is displayed next to the environment name.
💡 You may need to restart your environment for the change to take effect.
Your mock API will now be available on https://localhost:port
instead of http://localhost:port
.
Please note that Mockoon is using a self-signed certificate to serve your environment over TLS.
You can also provide your certificate in both PKCS12 or PEM formats by filling out the input fields with the path to the file(s).
Mockoon also supports passphrase-protected keys and custom-trusted CA certificates. As Mockoon is using Node.js' tls
, you can refer to the tls.createSecureContext()
documentation for a full description of the available options.
💡 All the path fields support both absolute and relative paths. Relative paths are resolved from the environment's file location.
You can disable TLS when running your mock with the CLI or the serverless library.
To disable TLS when running your mock with the CLI, use the --disable-tls
flag:
Copymockoon-cli start --disable-tls -d ./mock.json
📘 Check the CLI dedicated documentation
To disable TLS when running your mock with the serverless library, set the disableTLS
option to true
when building the MockoonServerless
instance:
Copyconst mockoonServerless = new mockoon.MockoonServerless(mockEnv, { disableTLS: true });
📘 Check the serverless library dedicated documentation