remove ssl support in node server.
Use a reverse proxy for this.
This commit is contained in:
parent
2dfbb522b0
commit
cffb0da833
@ -124,15 +124,6 @@ module.exports = {
|
|||||||
padContentSecurity: baseCSP.join('; ') +
|
padContentSecurity: baseCSP.join('; ') +
|
||||||
"script-src 'self' 'unsafe-eval' 'unsafe-inline'" + domain,
|
"script-src 'self' 'unsafe-eval' 'unsafe-inline'" + domain,
|
||||||
|
|
||||||
/* it is recommended that you serve CryptPad over https
|
|
||||||
* the filepaths below are used to configure your certificates
|
|
||||||
*/
|
|
||||||
//privKeyAndCertFiles: [
|
|
||||||
// '/etc/apache2/ssl/my_secret.key',
|
|
||||||
// '/etc/apache2/ssl/my_public_cert.crt',
|
|
||||||
// '/etc/apache2/ssl/my_certificate_authorities_cert_chain.ca'
|
|
||||||
//],
|
|
||||||
|
|
||||||
/* Main pages
|
/* Main pages
|
||||||
* add exceptions to the router so that we can access /privacy.html
|
* add exceptions to the router so that we can access /privacy.html
|
||||||
* and other odd pages
|
* and other odd pages
|
||||||
|
|||||||
28
server.js
28
server.js
@ -3,7 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
var Express = require('express');
|
var Express = require('express');
|
||||||
var Http = require('http');
|
var Http = require('http');
|
||||||
var Https = require('https');
|
|
||||||
var Fs = require('fs');
|
var Fs = require('fs');
|
||||||
var WebSocketServer = require('ws').Server;
|
var WebSocketServer = require('ws').Server;
|
||||||
var NetfluxSrv = require('./node_modules/chainpad-server/NetfluxWebsocketSrv');
|
var NetfluxSrv = require('./node_modules/chainpad-server/NetfluxWebsocketSrv');
|
||||||
@ -33,8 +32,6 @@ var Storage = require(config.storage||'./storage/file');
|
|||||||
|
|
||||||
var app = debuggable('app', Express());
|
var app = debuggable('app', Express());
|
||||||
|
|
||||||
var httpsOpts;
|
|
||||||
|
|
||||||
// mode can be FRESH (default), DEV, or PACKAGE
|
// mode can be FRESH (default), DEV, or PACKAGE
|
||||||
|
|
||||||
var FRESH_KEY = '';
|
var FRESH_KEY = '';
|
||||||
@ -162,29 +159,6 @@ app.use("/customize.dist", Express.static(__dirname + '/customize.dist'));
|
|||||||
app.use(/^\/[^\/]*$/, Express.static('customize'));
|
app.use(/^\/[^\/]*$/, Express.static('customize'));
|
||||||
app.use(/^\/[^\/]*$/, Express.static('customize.dist'));
|
app.use(/^\/[^\/]*$/, Express.static('customize.dist'));
|
||||||
|
|
||||||
if (config.privKeyAndCertFiles) {
|
|
||||||
var privKeyAndCerts = '';
|
|
||||||
config.privKeyAndCertFiles.forEach(function (file) {
|
|
||||||
privKeyAndCerts = privKeyAndCerts + Fs.readFileSync(file);
|
|
||||||
});
|
|
||||||
var array = privKeyAndCerts.split('\n-----BEGIN ');
|
|
||||||
for (var i = 1; i < array.length; i++) { array[i] = '-----BEGIN ' + array[i]; }
|
|
||||||
var privKey;
|
|
||||||
for (var i = 0; i < array.length; i++) {
|
|
||||||
if (array[i].indexOf('PRIVATE KEY-----\n') !== -1) {
|
|
||||||
privKey = array[i];
|
|
||||||
array.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!privKey) { throw new Error("cannot find private key"); }
|
|
||||||
httpsOpts = {
|
|
||||||
cert: array.shift(),
|
|
||||||
key: privKey,
|
|
||||||
ca: array
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var admins = [];
|
var admins = [];
|
||||||
try {
|
try {
|
||||||
admins = (config.adminKeys || []).map(function (k) {
|
admins = (config.adminKeys || []).map(function (k) {
|
||||||
@ -244,7 +218,7 @@ app.use(function (req, res, next) {
|
|||||||
send404(res, custom_four04_path);
|
send404(res, custom_four04_path);
|
||||||
});
|
});
|
||||||
|
|
||||||
var httpServer = httpsOpts ? Https.createServer(httpsOpts, app) : Http.createServer(app);
|
var httpServer = Http.createServer(app);
|
||||||
|
|
||||||
httpServer.listen(config.httpPort,config.httpAddress,function(){
|
httpServer.listen(config.httpPort,config.httpAddress,function(){
|
||||||
var host = config.httpAddress;
|
var host = config.httpAddress;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user