Skip to content

Commit

Permalink
Merge pull request #151 from impulsonetwork/revert-150-chore/ssl
Browse files Browse the repository at this point in the history
Revert "add force https"
  • Loading branch information
lazaroalvarenga authored Dec 28, 2018
2 parents 1dba6f2 + fa311a5 commit 35d1c8b
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ const app = express();

app.set("view engine", "pug");

// app.use(
// bodyParser.json({
// verify: function(req, res, buf) {
// var url = req.originalUrl;
// console.log("url", url, url.startsWith("/slack/events"));
// if (url.startsWith("/slack/events")) {
// req.rawBody = buf.toString();
// }
// }
// })
// );

app.use(
sassMiddleware({
src: path.join(__dirname, "stylesheets"),
Expand All @@ -74,24 +86,7 @@ app.use(
})
);

app.enable("trust proxy");

app.use((req, res, next) => {
if (
[
"production",
"staging"
].includes(process.env.NODE_ENV) &&
!req.secure
) {
res.redirect(`https://${req.headers.host}${req.url}`);
} else {
next();
}
});

app.use(express.static("public"));

app.use("/", appRoutes);

if (process.env.NODE_ENV !== "test") {
Expand Down

0 comments on commit 35d1c8b

Please sign in to comment.