Removed "heroku-ssl-redirect" package
This commit is contained in:
parent
5f24739d37
commit
a6d365450c
2 changed files with 12 additions and 16 deletions
|
@ -29,7 +29,6 @@
|
||||||
"fs-exists-sync": "^0.1.0",
|
"fs-exists-sync": "^0.1.0",
|
||||||
"got": "^9.5.0",
|
"got": "^9.5.0",
|
||||||
"graceful-fs": "^4.1.15",
|
"graceful-fs": "^4.1.15",
|
||||||
"heroku-ssl-redirect": "0.0.4",
|
|
||||||
"make-promises-safe": "^4.0.0",
|
"make-promises-safe": "^4.0.0",
|
||||||
"markdown-it": "^8.4.2",
|
"markdown-it": "^8.4.2",
|
||||||
"markdown-it-anchor": "^5.0.2",
|
"markdown-it-anchor": "^5.0.2",
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
const color = require("colorette");
|
const color = require("colorette");
|
||||||
const cors = require("cors");
|
const cors = require("cors");
|
||||||
const local = require("app-root-path").require;
|
const local = require("app-root-path").require;
|
||||||
// const ssl = require("heroku-ssl-redirect");
|
|
||||||
|
|
||||||
const fastify = require("fastify")({
|
const fastify = require("fastify")({
|
||||||
logger: {
|
logger: {
|
||||||
|
@ -26,7 +25,6 @@ const messageSlack = local("app/helpers/slack").default;
|
||||||
// P R O G R A M
|
// P R O G R A M
|
||||||
|
|
||||||
fastify
|
fastify
|
||||||
// .use(ssl())
|
|
||||||
.use(cors())
|
.use(cors())
|
||||||
.register(require("fastify-compress"))
|
.register(require("fastify-compress"))
|
||||||
.register(require("@inc/fastify-ws"))
|
.register(require("@inc/fastify-ws"))
|
||||||
|
@ -39,12 +37,11 @@ fastify
|
||||||
})
|
})
|
||||||
.register(require("choo-ssr/fastify"), {
|
.register(require("choo-ssr/fastify"), {
|
||||||
app: require("./app")
|
app: require("./app")
|
||||||
});
|
})
|
||||||
|
.addHook("preHandler", (request, reply, next) => {
|
||||||
fastify.addHook("preHandler", (request, reply, next) => {
|
|
||||||
if (process.env.NODE_ENV !== "development") {
|
if (process.env.NODE_ENV !== "development") {
|
||||||
if (request.headers["x-forwarded-proto"] !== "https")
|
if (request.headers["x-forwarded-proto"] !== "https")
|
||||||
reply.redirect(302, "https://" + request.raw.hostname + request.raw.originalUrl);
|
reply.redirect(302, `https://${request.raw.hostname}${request.raw.originalUrl}`);
|
||||||
|
|
||||||
else
|
else
|
||||||
next();
|
next();
|
||||||
|
|
Loading…
Reference in a new issue