Apache and NodeJS over SSL

前端 未结 3 1666
情话喂你
情话喂你 2021-01-02 05:57

I need to switch from HTTP to HTTPS to be able to use the getUsermedia for webrtc implementation. I\'ve installed certificates on my Apache version 2.2.22 and got it working

3条回答
  •  醉话见心
    2021-01-02 06:49

    proxy nodejs

    var proxy = require('http-proxy').createProxyServer();
    var fs = require('fs');
    
    express = require('express.io');
    app = express();
    
    
    var SSloptions = {
        key:    fs.readFileSync('/var/www/node/certificados/mig.xxx.key'),
        cert:   fs.readFileSync('/var/www/node/certificados/xxx.crt'),    
        ca: [
            fs.readFileSync('/var/www/node/certificados/gd_bundle-xx.crt')
        ],
        rejectUnauthorized: false,
        requestCert: true,
        agent: false,
        strictSSL: false
    };
    
    
    app.https(SSloptions).io();
    
    
    app.all('*', function(req, res){
        proxy.web(req, res, {
    
            target: 'http://localhost:4443',
        });    
    });
    
    
    
    app.listen(14443);
    

提交回复
热议问题