Heroku test
This commit is contained in:
parent
027fbda327
commit
a682f945c0
1 changed files with 12 additions and 0 deletions
12
server.js
12
server.js
|
@ -41,6 +41,18 @@ fastify
|
|||
app: require("./app")
|
||||
});
|
||||
|
||||
fastify.addHook("preHandler", (request, reply, next) => {
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
if (request.headers["x-forwarded-proto"] !== "https")
|
||||
reply.redirect(302, "https://" + request.hostname + request.originalUrl);
|
||||
|
||||
else
|
||||
next();
|
||||
}
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
fastify.ready(err => {
|
||||
if (err) throw err;
|
||||
|
||||
|
|
Loading…
Reference in a new issue