Quantcast
Channel: CodeSection,代码区,网络安全 - CodeSec
Viewing all articles
Browse latest Browse all 12749

Change notification system to SSL.(right now it's blocked when using https in Ch ...

$
0
0

I hava a notification system in my site and I am trying to change it from http to https.

But my app.js is listing to port 8888 now.

Is there a quick way I can modify it? I tried several ways online but not works.

(Right now my curl is something like http://myipaddress:8888 )

Thanks so much! I really appreciate it.

/* CONFIGURATION */ /* Web Server Config */ var _postpath = '/send'; var _listenport = 8888; var _listenaddr = '0.0.0.0'; //use '0.0.0.0' to listen on all interfaces /* Slave (sub) Redis Server Config */ var _channelfilter = '*'; var _sub_db_addr = '127.0.0.1'; var _sub_db_passwd_protected = true; var _sub_db_passwd = 'mypassword'; var _sub_db_port = 6379; //default redis port is 6379 /* Master (pub) Redis Server Config */ var _pub_db_addr = '127.0.0.1'; var _pub_db_passwd_protected = true; var _pub_db_passwd = 'mypassword'; var _pub_db_port = 6379; //default redis port is 6379 /* add pub.auth(_pub_db_passwd) in function to enable password /* SocketIO Config */ var _loglevel = 1; /* simple-pub-sub Config */ var _secretkey = "mypassword"; /* SERVER CODE -- DO NOT MODIFY */ redis = require('redis'); express = require('express'); socketio = require('socket.io'); fs = require("fs"), pub = redis.createClient(_pub_db_port, _pub_db_addr); if (_pub_db_passwd_protected) { } sub = redis.createClient(_sub_db_port, _sub_db_addr); if (_sub_db_passwd_protected) { } sub.on("pmessage", function(pattern, channel, json) { io.sockets.volatile.emit(channel, JSON.parse(json)); }); sub.psubscribe('*'); app = express.createServer(express.static(__dirname + '/public'),express.bodyParser()); app.listen(_listenport, _listenaddr); app.post(_postpath, function(req, res){ if(req.body.secretkey==_secretkey){ delete req.body.secretkey; pub.publish(req.body.channel, JSON.stringify(req.body)); res.send(200); } }); io = socketio.listen(app); io.configure(function () { io.set('log level', _loglevel) });

Problem courtesy of: jackhao


Viewing all articles
Browse latest Browse all 12749

Latest Images

Trending Articles





Latest Images