mirror of
https://codeberg.org/tacerus/teddit.git
synced 2024-11-25 16:49:26 +01:00
redirect http => https before initializing reddit API (fixes #241)
This commit is contained in:
parent
9e515c4985
commit
8bb949b2b3
14
app.js
14
app.js
@ -106,6 +106,13 @@ app.use(express.static(`${__dirname}/static`));
|
|||||||
app.set('views', './views');
|
app.set('views', './views');
|
||||||
app.set('view engine', 'pug');
|
app.set('view engine', 'pug');
|
||||||
|
|
||||||
|
if (config.redirect_http_to_https) {
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
if (req.secure) next();
|
||||||
|
else res.redirect(`https://${req.headers.host}${req.url}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const redditAPI = require('./inc/initRedditApi.js')(fetch);
|
const redditAPI = require('./inc/initRedditApi.js')(fetch);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -121,13 +128,6 @@ app.use('/', allRoutes);
|
|||||||
// The old routes
|
// The old routes
|
||||||
//require('./routes')(app, redis, fetch, redditAPI);
|
//require('./routes')(app, redis, fetch, redditAPI);
|
||||||
|
|
||||||
if (config.redirect_http_to_https) {
|
|
||||||
app.use((req, res, next) => {
|
|
||||||
if (req.secure) next();
|
|
||||||
else res.redirect(`https://${req.headers.host}${req.url}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const cacheControl = require('./cacheControl.js');
|
const cacheControl = require('./cacheControl.js');
|
||||||
cacheControl.removeCacheFiles();
|
cacheControl.removeCacheFiles();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user