[Vuejs]-How to fix error "net::ERR_SSL_SERVER_CERT_BAD_FORMAT" When useing vuejs and nodejs with https and express

0👍

Taking the certificate PEM shown in the question one can do a openssl x509 -text and see:

Certificate:
    Data:
        Version: 1 (0x0)
        ...
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=localhost
        ...
        Subject: CN=localhost

Thus, this is a X509v1 certificate issued for localhost. It does not have any Subject Alternative Names extension as required by at least Chrome. Only X509v3 certificates can have such extensions and they need to be specifically configured. The documentation of pem contains examples on how to create certificates with the necessary extensions.

0👍

axios performing a GET request, you should send data in url

axios.get('/user?ID=12345')
  .then(function (response) {
    // handle success
    console.log(response);
  })
  .catch(function (error) {
    // handle error
    console.log(error);
  })
  .finally(function () {
    // always executed
  })

and performing a POST request

axios.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

now in your code you send POST request and this have object to send, you shod use

Axios.post('https://localhost:443/api/getpeople',{ withCredentials: 
             true}).then(response=>response.data).then(result=>{
                   commit('setPeople',result);
               }).catch(error=>{
             console.log(error.response)

for GET request

Axios.get('https://localhost:443/api/getpeople').then(response=>response.data).then(result=>{
                   commit('setPeople',result);
               }).catch(error=>{
             console.log(error.response)

Leave a comment