Skip to content

Commit 28a6f50

Browse files
Tristramgmuxator
authored andcommitted
Parameters: the version is exposed in http header only when configured
Currently the version is exposed in a 'Server' http headers. This commit allows to parameterize it in the settings. By defaults it is not exposed. Fixes ether#3423
1 parent 8453f07 commit 28a6f50

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

settings.json.template

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,13 @@
409409
*/
410410

411411
/*
412+
* Expose Etherpad version in the Server http header.
413+
*
414+
* Do not enable on production machines.
415+
*/
416+
"exposeVersion": false,
417+
418+
/*
412419
* The log level we are using.
413420
*
414421
* Valid values: DEBUG, INFO, WARN, ERROR

src/node/hooks/express.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ exports.restartServer = function () {
7575
// Stop IE going into compatability mode
7676
// https://github.com/ether/etherpad-lite/issues/2547
7777
res.header("X-UA-Compatible", "IE=Edge,chrome=1");
78-
res.header("Server", serverName);
78+
79+
// send git version in the Server response header if exposeVersion is true.
80+
if (settings.exposeVersion) {
81+
res.header("Server", serverName);
82+
}
83+
7984
next();
8085
});
8186

src/node/utils/Settings.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ exports.scrollWhenFocusLineIsOutOfViewport = {
291291
"scrollWhenCaretIsInTheLastLineOfViewport": false
292292
};
293293

294+
/*
295+
* Expose Etherpad version in the Server http header.
296+
*
297+
* Do not enable on production machines.
298+
*/
299+
exports.exposeVersion = false;
300+
294301
// checks if abiword is avaiable
295302
exports.abiwordAvailable = function()
296303
{

0 commit comments

Comments
 (0)