浏览代码

Allow for listening only on 127.0.0.1 (or some other address) (#161)

dev_h
Ingo Blechschmidt 4 年前
父节点
当前提交
2e0a901998
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 11 次插入2 次删除
  1. 5
    1
      README.md
  2. 5
    0
      server/configuration.js
  3. 1
    1
      server/server.js

+ 5
- 1
README.md 查看文件

@@ -64,7 +64,11 @@ Finally, you can start the server:
64 64
 PORT=5001 npm start
65 65
 ```
66 66
 
67
-This will run WBO directly on your machine, on port 5001, without any isolation from the other services.
67
+This will run WBO directly on your machine, on port 5001, without any isolation from the other services. You can also use an invokation like
68
+```
69
+PORT=5001 HOST=127.0.0.1 npm start
70
+```
71
+to make whitebophir only listen on the loopback device. This is useful if you want to put whitebophir behind a reverse proxy.
68 72
 
69 73
 ### Running WBO on a subfolder
70 74
 

+ 5
- 0
server/configuration.js 查看文件

@@ -5,6 +5,11 @@ module.exports = {
5 5
     /** Port on which the application will listen */
6 6
     PORT: parseInt(process.env['PORT']) || 8080,
7 7
 
8
+    /** Host on which the application will listen (defaults to undefined,
9
+        hence listen on all interfaces on all IP addresses, but could also be
10
+        '127.0.0.1' **/
11
+    HOST: process.env['HOST'] || undefined,
12
+
8 13
     /** Path to the directory where boards will be saved by default */
9 14
     HISTORY_DIR: process.env['WBO_HISTORY_DIR'] || path.join(app_root, "server-data"),
10 15
 

+ 1
- 1
server/server.js 查看文件

@@ -22,7 +22,7 @@ if (parseFloat(process.versions.node) < MIN_NODE_VERSION) {
22 22
 
23 23
 var io = sockets.start(app);
24 24
 
25
-app.listen(config.PORT);
25
+app.listen(config.PORT, config.HOST);
26 26
 log("server started", { port: config.PORT });
27 27
 
28 28
 var CSP = "default-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' ws: wss:";

正在加载...
取消
保存