mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 16:30:34 +01:00
perf: only add middleware if relativePath is set
This commit is contained in:
@@ -137,8 +137,14 @@ function setupExpressApp(app) {
|
||||
const compression = require('compression');
|
||||
app.use(compression());
|
||||
}
|
||||
|
||||
app.use(middleware.ensureRelativePath);
|
||||
if (relativePath) {
|
||||
app.use((req, res, next) => {
|
||||
if (!req.path.startsWith(relativePath)) {
|
||||
return require('./controllers/helpers').redirect(res, req.path);
|
||||
}
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
||||
app.get(`${relativePath}/ping`, pingController.ping);
|
||||
app.get(`${relativePath}/sping`, pingController.ping);
|
||||
|
||||
Reference in New Issue
Block a user