Closed EddiDin closed 5 years ago
This is not possible yet. I recommend to run the cluster on HTTP and use a reverse proxy via e.g. NGINX. I think that new update will support HTTPS in cluster.
Thanks. I will wait for the update!
Hi @EddiDin,
I have added https
into the cluster
. Try it $ npm install total.js@beta
and let me know.
Hi @pertersirka I have got a error message on Chrome : ERR_SSL_VERSION_OR_CIPHER_MISMATCH my index.js // =================================================== // FOR DEVELOPMENT // Total.js - framework for Node.js platform // https://www.totaljs.com // ===================================================
const options = {}; options.ip = '0.0.0.0'; options.port = parseInt(process.argv[2]); const fs = require('fs'); options.https = { key: fs.readFileSync('/etc/letsencrypt/live/xxx.xxx.xxx/privkey.pem'), cert: fs.readFileSync('/etc/letsencrypt/live/xxx.xxx.xxx/cert.pem') }
require('total.js').cluster.https('auto', 'debug', options);
@neophylon and does it work with:
require('total.js').https('debug', options);
?
Sorry for late. if i use 'require('total.js').https('debug', options);', everything is fine. So, now I have used only https not cluster https. But I want to use cluster https. I installed totaljs@beta version already.
Shit, sorry --> my bad, try this:
require('total.js').cluster.https(5, 'debug', options);
when I use
require('total.js').cluster.https(5, 'debug', options);
I still get the error "ERR_SSL_VERSION_OR_CIPHER_MISMATCH" on the Chrome browser
So, I try to modify my index.js and total.js/cluster.js.
index.js
options.https = {
key: fs.readFileSync('/etc/letsencrypt/live/domain.com/privkey.pem'),
cert: fs.readFileSync('/etc/letsencrypt/live/domain.com/cert.pem')
}
==>
options.https = {
key: '/etc/letsencrypt/live/domain.com/privkey.pem',
cert: '/etc/letsencrypt/live/domain.com/cert.pem'
}
require('total.js').cluster.https(5, 'debug', options);
total.js/cluster.js
function on_init(msg){
......................
if (msg.https){
msg.options.https.key = Fs.readFileSync(msg.options.https.key);
msg.options.https.cert = Fs.readFileSync(msg.options.https.cert);
F.https(msg.mode, msg.options);
}else{
F.http(msg.mode, msg.options);
}
.....................
It works.
Great, just create a pull request if you can to v3.2.0
. Just let me know if you can't make pull request.
Thank you, But it can't use with "require('total.js').https('debug',options);". So, I'm just temporary using it.
Mhhh, I know where is the problem. Buffer (with of key + cert) is not sent to child process. I'll fix it today.
I have fixed it. Sorry for delay. Try it $ npm install total.js@beta
. Now you can use as you wrote:
options.https = {
key: '/etc/letsencrypt/live/domain.com/privkey.pem',
cert: '/etc/letsencrypt/live/domain.com/cert.pem'
};
// OR
options.https = {
key: 'BASE64',
cert: 'BASE64'
}
Thank you!
I update total.js@beta. then try it I got the follow error
2019-01-18 13:39:10: Error: error:0906D06C:PEM routines:PEM_read_bio:no start line Error: error:0906D06C:PEM routines:PEM_read_bio:no start line at Object.createSecureContext (_tls_common.js:88:17) at Server (_tls_wrap.js:819:25) at new Server (https.js:60:14) at Object.createServer (https.js:80:10) at listen (/opt/cluster_test/node_modules/total.js/index.js:6799:21) at /opt/cluster_test/node_modules/total.js/index.js:6826:6 at /opt/cluster_test/node_modules/total.js/index.js:3920:16 at Array.AP.async (/opt/cluster_test/node_modules/total.js/utils.js:5015:16) at /opt/cluster_test/node_modules/total.js/index.js:3915:16 at Array.AP.async (/opt/cluster_test/node_modules/total.js/utils.js:5015:16)
Show me your code how you run the app.
index.js // =================================================== // FOR DEVELOPMENT // Total.js - framework for Node.js platform // https://www.totaljs.com // ===================================================
const options = {}; options.ip = '0.0.0.0'; options.port = parseInt(process.argv[2]); options.https = { key:'/etc/letsencrypt/live/xxx.xxx.xxx/privkey.pem', cert:'/etc/letsencrypt/live/xxx.xxx.xxx/cert.pem' }
require('total.js').cluster.https(4, 'debug', options); //require('total.js').https('debug', options);
// Use a terminal for testing: // $ siege -b -r 10 http://127.0.0.1:8000/
total.js version : "total.js": "^3.2.0-6"
I have tested it. It works correctly.
2019-01-18 13:39:10: Error: error:0906D06C:PEM routines:PEM_read_bio:no start line Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
This error means that you have invalid certificate or key.
Hello. How can i start cluster on https? (I didn't find this information in docs).