BigWhite
BigWhite

Reputation: 39

error : "ERR_SSL_VERSION_OR_CIPHER_MISMATCH"

I want to use https on my web locally. Using Nuxt framework, and create a nodejs server.

I follow these command to create key.

openssl genrsa 2048 > server.key
chmod 400 server.key
openssl req -new -x509 -nodes -sha256 -days 365 -key server.key -out server.crt

then have these code on my server.

const app = express()
const path = require('path')
const fs = require('fs')

const option = {
  https: {
    key: fs.readFileSync(path.resolve(__dirname, 'server.key')),
    cert: fs.readFileSync(path.resolve(__dirname, 'server.crt'))
  }
}

const server = require('https').createServer(option, app)
server.listen(port, host)

I have hosts setting 172.0.0.1 local.xxx.com.

when I call my web on chrome https://local.xxx.com

I will get error: ERR_SSL_VERSION_OR_CIPHER_MISMATCH

try others browser, get similar error

Upvotes: 1

Views: 2145

Answers (1)

BigWhite
BigWhite

Reputation: 39

fix it!

this error cause my option have excessive 'https',fix it then it works.

const option = {
    key: fs.readFileSync(path.resolve(__dirname, 'server.key')),
    cert: fs.readFileSync(path.resolve(__dirname, 'server.crt'))
}

Upvotes: 1

Related Questions