Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insomnia : Error: SSL peer certificate or SSH remote key was not OK

I added my own certificate to a node.js express server for testing purposes. Then I attempted to contact the post from Insomnia, but I received an error message.

Error: SSL peer certificate or SSH remote key was not OK

The server code:

const express = require('express');
const path = require('path');
const fs = require("fs");
var https = require('https');

var privateKey = fs.readFileSync('cert/server.key');
var certificate = fs.readFileSync('cert/server.crt');

var credentials = {key: privateKey, cert: certificate};
const app = express()
const port = 8000
// app.use(express.urlencoded()); 
app.use(express.json());
// Routes
app.get('/', (req, res) => {
  res.sendFile(path.join(__dirname, './public/index.html'));
})
 
app.post('/signin', (req, res) => {
  console.log(req.body.username);
  methods.signin();
  res.end();
})

app.use(express.static('public'))
var httpsServer = https.createServer(credentials, app);
httpsServer.listen(port);
console.log('Server started at https://localhost:' + port);

like image 207
ErmiaHP Avatar asked Sep 09 '25 17:09

ErmiaHP


2 Answers

Go into your setting/preferences and under Request/Response uncheck Validate certificates
Uncheck Validate Certificates

like image 185
nick3point5 Avatar answered Sep 12 '25 06:09

nick3point5


My problem was only solved after creating a certificate file with the entire chain of information (SERVER CERT + ROOT CERT + INTERMEDIATE CERT)

enter image description here

like image 45
Arkt Diogo Avatar answered Sep 12 '25 05:09

Arkt Diogo