Enabling SSL

1. Get a certificate

You can use your existing certificate or create a new one using mkcert utility. Follow the installation guide for your platform.
After installation install mkcert certificate into your system by running the command below:
1
mkcert -install
Copied!
Now we need to create a certificate. To create a certificate run command below:
1
> mkcert localhost 127.0.0.1
2
​
3
Created a new certificate valid for the following names πŸ“œ
4
- "localhost"
5
- "127.0.0.1"
6
​
7
The certificate is at "./localhost+1.pem" and the key at "./localhost+1-key.pem" βœ…
8
​
9
It will expire on 13 May 2023 πŸ—“
Copied!
Now we have all files that we need for CMA config.

2. Setup CMA

Add to your cma.js file field ssl with the following object:
1
module.export = {
2
... other configuration
3
ssl: {
4
enabled: true,
5
ssl_certificate: './localhost+1.pem',
6
ssl_certificate_key: './localhost+1-key.pem'
7
}
8
}
Copied!
That is it! Just now we have enabled SSL in our application! Now to apply changes we need to run start command without -s option.
You can run only one application with SSL enabled at the time because it will use port 443 which is the default port for SSL.
Last modified 9mo ago