Showing posts with label https nodejs. Show all posts
Showing posts with label https nodejs. Show all posts

Thursday, 21 April 2016

Enabling https on node js using proxy

App.js

var https = require('https');

var fs = require('fs');


 var options = {
 key: fs.readFileSync('/etc/apache2/ssl/apache.key'),
 cert: fs.readFileSync('/etc/apache2/ssl/apache.crt')
};

// Create an HTTPS service identical to the HTTP service.
https.createServer(options,app).listen(5000);


Configuration in /etc/apache2/sites-available/default-ssl.conf

On Ubuntu or debain

SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

ProxyPass /naf/node/ https://localhost:5000/naf/node/

On RedHat 

       SSLProxyEngine On
        SSLProxyVerify none
        SSLProxyCheckPeerCN off
        SSLProxyCheckPeerExpire off

        ProxyPreserveHost On
        <Proxy balancer://nodecluster>
        BalancerMember https://172.16.84.96:5000
        </Proxy>
        ProxyPass /naf/inbox balancer://nodecluster/naf/inbox