Skip to content

Instantly share code, notes, and snippets.

@hampusborgos
Last active August 31, 2018 09:39

Revisions

  1. Hampus Joakim Nilsson revised this gist Jan 3, 2016. 1 changed file with 12 additions and 12 deletions.
    24 changes: 12 additions & 12 deletions web.js
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,12 @@
    app.use(function (req, res, next) {
    var sslUrl;
    if (process.env.NODE_ENV === 'production' &&
    req.headers['x-forwarded-proto'] !== 'https') {
    sslUrl = ['https://hjnilsson.com', req.url].join('');
    return res.redirect(sslUrl);
    }
    return next();
    });
    app.use(function (req, res, next) {
    var sslUrl;

    if (process.env.NODE_ENV === 'production' &&
    req.headers['x-forwarded-proto'] !== 'https') {

    sslUrl = ['https://hjnilsson.com', req.url].join('');
    return res.redirect(sslUrl);
    }

    return next();
    });
  2. Hampus Joakim Nilsson created this gist Jan 3, 2016.
    12 changes: 12 additions & 0 deletions web.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    app.use(function (req, res, next) {
    var sslUrl;

    if (process.env.NODE_ENV === 'production' &&
    req.headers['x-forwarded-proto'] !== 'https') {

    sslUrl = ['https://hjnilsson.com', req.url].join('');
    return res.redirect(sslUrl);
    }

    return next();
    });