0

I have an Angular 8 application working fine on http.

I just installed a letsencrypt cetificate running "certbot --apache". The certificate is valid and I can see the safety lock on my domain now.

After fixing the environment issue that came up after installing the certificate,

apiUrl: 'https://app.xyz.com:8080'

I got a new error now (net::ERR_SSL_PROTOCOL_ERROR) indicating that backend can´t see the certificate running on front end and can´t handle a https connection.

How do I "pass" the certificate I just created to backend so both can comunicate properly? Or, do I need to install a second SSL Certificate on Back End?

1 Answer 1

0

After I got some help outside from Stackoverflow, I got it right.

For anyone from the future who is facing the same problem, here is what I did. I created another port on my backend server (Node.js) like so:

//Server
const https = require("https");
const express = require('express');
const app = express();
var app_https = express();
var cors = require('cors');
const fs = require("fs");

app.use(express.json(), cors());
app_https.use(express.json(), cors());

const options = {
  key: fs.readFileSync('../src/assets/keys/privkey.pem'),
  cert: fs.readFileSync('../src/assets/keys/cert.pem')
};
app_https = https.createServer(options, app);

//PORT ENVIRONMENT VARIABLE
const port = process.env.PORT;

app_https.listen(port, () => console.log(`Running on port localhost:${port}`));
This was enough to access "https://www.xyzabcpqr.com:port/api/" and put it back 
together.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.