With this script you were able to create certificates simply, with just one command executed via the prompt.
The idea is to facilitate the creation of certificates for developers who use the VUE3 connection and need to test the system using SSL / Https running on localhost
Follow the steps to install the script. Don't skip any steps.
git clone https://github.com/Tellys/create-ssl-vue-https-server-localhost.git
cd create-ssl-vue-https-server-localhost
Remember that the variables here are extremely important, because if they are not filled in correctly, the certificate may not work / may not be recognized by the server
cd tool-create-certs-ssl
Open the openssl-custom.cnf file
//openssl-custom.cnf
[dn]
C = <COUNTRY>
ST = <STATE>
L = <LOCALITY / CITY>
O = <ORGANIZATION>
OR = <ORGANIZATION_UNIT>
emailAddress = <EMAIL_ADDRESS>
CN=<HOSTNAME/IP_ADDRESS>
bash generate.sh
cd ../vue3-ssl
npm i
mkdir certs
mv ../tool-create-certs-ssl/server.key ../tool-create-certs-ssl/server.crt certs/
//vue.config.js
const { defineConfig } = require('@vue/cli-service')
const fs = require('fs');
module.exports = defineConfig({
transpileDependencies: true,
devServer: {
server: {
type: 'https',
options: {
key: fs.readFileSync('./certs/server.key'),
cert: fs.readFileSync('./certs/server.crt'),
}
},
client: {
webSocketURL: 'wss://localhost:8080/ws',
},
}
})
npm run serve
For More Information, access o link Tutorial Vue3 + SSL HTTPS - https://www.conteudopertinente.com.br/vue3/create-ssl-vue-3-with-https-server-localhost-test/