From 1d5a2091f6e1c4c89c3a787d241682064ed61cdb Mon Sep 17 00:00:00 2001 From: Ian Ramzy Date: Wed, 25 Mar 2020 23:31:26 -0400 Subject: [PATCH] heroku ssl attempt --- package-lock.json | 5 +++++ package.json | 1 + server.js | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 59d573c..3c41cc9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -538,6 +538,11 @@ "resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz", "integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk=" }, + "heroku-ssl-redirect": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/heroku-ssl-redirect/-/heroku-ssl-redirect-0.0.4.tgz", + "integrity": "sha1-IboHB6pQO1CkEqCUar+qiO99CCw=" + }, "http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", diff --git a/package.json b/package.json index 0024a9f..dbebbce 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "dependencies": { "dotenv": "^8.1.0", "express": "^4.17.1", + "heroku-ssl-redirect": "0.0.4", "socket.io": "^2.2.0", "twilio": "^3.34.0" } diff --git a/server.js b/server.js index e4946e7..29f51d8 100644 --- a/server.js +++ b/server.js @@ -1,5 +1,5 @@ require('dotenv').config(); - +var sslRedirect = require('heroku-ssl-redirect'); var twilio = require('twilio')(process.env.TWILIO_ACCOUNT_SID, process.env.TWILIO_AUTH_TOKEN); var express = require('express'); var app = express(); @@ -8,7 +8,8 @@ var io = require('socket.io')(http); var path = require('path'); var public = path.join(__dirname, 'public'); - +// enable ssl redirect +app.use(sslRedirect()); app.use(express.static('public'));