mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
feat: #8801, disable express compression by default
This commit is contained in:
@@ -134,5 +134,6 @@
|
|||||||
"necroThreshold": 7,
|
"necroThreshold": 7,
|
||||||
"categoryWatchState": "watching",
|
"categoryWatchState": "watching",
|
||||||
"submitPluginUsage": 1,
|
"submitPluginUsage": 1,
|
||||||
"maxUserSessions": 10
|
"maxUserSessions": 10,
|
||||||
|
"useCompression": 0
|
||||||
}
|
}
|
||||||
@@ -36,5 +36,8 @@
|
|||||||
|
|
||||||
"analytics.settings": "Analytics Settings",
|
"analytics.settings": "Analytics Settings",
|
||||||
"analytics.max-cache": "Analytics Cache Max Value",
|
"analytics.max-cache": "Analytics Cache Max Value",
|
||||||
"analytics.max-cache-help": "On high-traffic installs, the cache could be exhausted continuously if there are more concurrent active users than the Max Cache value. (Restart required)"
|
"analytics.max-cache-help": "On high-traffic installs, the cache could be exhausted continuously if there are more concurrent active users than the Max Cache value. (Restart required)",
|
||||||
|
"compression.settings": "Compression Settings",
|
||||||
|
"compression.enable": "Enable Compression",
|
||||||
|
"compression.help": "This setting enables gzip compression. For a high-traffic website in production, the best way to put compression in place is to implement it at a reverse proxy level. You can enable it here for testing purposes."
|
||||||
}
|
}
|
||||||
@@ -165,4 +165,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 col-xs-12 settings-header">[[admin/settings/advanced:compression.settings]]</div>
|
||||||
|
<div class="col-sm-10 col-xs-12">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<p class="help-block">
|
||||||
|
[[admin/settings/advanced:compression.help]]
|
||||||
|
</p>
|
||||||
|
<div class="checkbox">
|
||||||
|
<label class="mdl-switch mdl-js-switch mdl-js-ripple-effect">
|
||||||
|
<input class="mdl-switch__input" type="checkbox" data-field="useCompression">
|
||||||
|
<span class="mdl-switch__label"><strong>[[admin/settings/advanced:compression.enable]]</strong></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- IMPORT admin/partials/settings/footer.tpl -->
|
<!-- IMPORT admin/partials/settings/footer.tpl -->
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ var server;
|
|||||||
var winston = require('winston');
|
var winston = require('winston');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var flash = require('connect-flash');
|
var flash = require('connect-flash');
|
||||||
var compression = require('compression');
|
|
||||||
var bodyParser = require('body-parser');
|
var bodyParser = require('body-parser');
|
||||||
var cookieParser = require('cookie-parser');
|
var cookieParser = require('cookie-parser');
|
||||||
var session = require('express-session');
|
var session = require('express-session');
|
||||||
@@ -134,7 +133,10 @@ function setupExpressApp(app) {
|
|||||||
app.enable('minification');
|
app.enable('minification');
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use(compression());
|
if (meta.config.useCompression) {
|
||||||
|
const compression = require('compression');
|
||||||
|
app.use(compression());
|
||||||
|
}
|
||||||
|
|
||||||
app.get(relativePath + '/ping', pingController.ping);
|
app.get(relativePath + '/ping', pingController.ping);
|
||||||
app.get(relativePath + '/sping', pingController.ping);
|
app.get(relativePath + '/sping', pingController.ping);
|
||||||
|
|||||||
Reference in New Issue
Block a user