Skip to content

Instantly share code, notes, and snippets.

@palakbhansali
Created September 11, 2014 13:51
Show Gist options
  • Save palakbhansali/f7d3176bbef31f1ec7ee to your computer and use it in GitHub Desktop.
Save palakbhansali/f7d3176bbef31f1ec7ee to your computer and use it in GitHub Desktop.
express-cdn not working in production mode
var sslEnabled = false;
// Set the CDN options
var options = {
publicDir : path.join(__dirname, '/../public'),
viewsDir : path.join(__dirname, '/../views'),
domain : <cdn.mysite.com>,
bucket : <bucket-mysitename>,
key : <aws user access key id>,
secret : <aws user key secret>,
endpoint : <bucket-name>.s3.amazonaws.com', // optional
hostname : <mysite.com>,
port : (sslEnabled) ? 443 : app.get('port'),
ssl : sslEnabled,
production: true,
logger : winston.info
};
// Initialize the CDN magic
var CDN = require('express-cdn')(app, options);
// Add the view helper
app.locals.CDN = CDN();
require('../server');
http.createServer(app)
.listen(app.get('port'), function () {
console.log('Express production server listening on port '.blue + app.get('port'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment