Answer the question
In order to leave comments, you need to log in
How to properly upload assets in nodejs express using ssl?
Using code like this (below) ssl works fine for preset roots, root using express.static works with mixed success. Sometimes when requesting the file "/assets/img/image_name.extension" it gives the client an error 525. How to fix it?
var app = express();
var options = {
key: fs.readFileSync(__dirname+'/certificate.key'),
cert: fs.readFileSync(__dirname+'/cert.crt'),
requestCert: true
};
var server = http.createServer(app);
var secureServer = https.createServer(options, app);
var io = require('socket.io').listen(secureServer);
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
app.use(session({secret: g_ExpressSecret, name: g_ExpressName, resave: true, saveUninitialized: true}));
app.use(passport.initialize());
app.use(passport.session());
app.use(forceSSL);
app.use('/assets', express.static(__dirname + '/views/public'));
secureServer.listen(443);
server.listen(80);
app.get('/', function(req, res){
console.log('requested /');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question