Showing results for 
Show  only  | Search instead for 
Did you mean: 

Deploy Nodejs application on HTTPS

I managed to deploy noddjs application using basic app.listen(...), which is not secured.

I've been trying to deploy the app on https.

Whatever I do, it throws Proxy Error sometimes, and 302 Found other times.


My .htaccess file looks like this:

RewriteEngine on
RewriteRule ^(.*)$ https://localhost:8080/$1 [R,L]


My js file looks like this

const privateKey = fs.readFileSync('../../ssl/keys/mykey.key').toString();
const certificate = fs.readFileSync('../../ssl/certs/mycert.crt').toString();
const https_server = https.createServer({key: privateKey, cert: certificate}, app)
https_server.listen(8080, async () => { ... })
Am I missing something here?