TLS


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.

 Activate the TLS option

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:

click on the settings tab

Enable the TLS option by ticking the checkbox. The option was successfully activated if a yellow lock is displayed next to the environment name.

tick the TLS checkbox

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.

 Provide your own certificate

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).

add certificate path

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.

 Disable TLS at runtime with the CLI or serverless library

You can disable TLS when running your mock with the CLI or the serverless library.

 Disable TLS with the CLI

To disable TLS when running your mock with the CLI, use the --disable-tls flag:

Copy
mockoon-cli start --disable-tls -d ./mock.json

 Disable TLS with the serverless library

To disable TLS when running your mock with the serverless library, set the disableTLS option to true when building the MockoonServerless instance:

Copy
const mockoonServerless = new mockoon.MockoonServerless(mockEnv, { disableTLS: true });