@rpcbase/server 0.281.0 → 0.283.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/express/index.js CHANGED
@@ -11,7 +11,7 @@ const sessions = require("../src/sessions")
11
11
 
12
12
  const dev_save_coverage = require("./dev_save_coverage")
13
13
  const custom_cors = require("./custom_cors")
14
- const block_invalid_hosts = require("./block_invalid_hosts")
14
+
15
15
 
16
16
  const log = debug("rb:server")
17
17
 
@@ -54,8 +54,6 @@ module.exports = () => {
54
54
  app.use(Sentry.Handlers.tracingHandler())
55
55
  }
56
56
 
57
- block_invalid_hosts(app)
58
-
59
57
  app.use(request_ip.mw())
60
58
 
61
59
  app.use(body_parser.json({limit: `${BODY_MAX_SIZE_MB}mb`}))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpcbase/server",
3
- "version": "0.281.0",
3
+ "version": "0.283.0",
4
4
  "license": "SSPL-1.0",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -1,26 +0,0 @@
1
- /* @flow */
2
- const assert = require("assert")
3
-
4
- const {APP_DOMAIN} = process.env
5
-
6
- const is_production = process.env.NODE_ENV === "production"
7
-
8
- const block_invalid_hosts = (app) => {
9
-
10
- // only block invalid hosts in production
11
- if (!is_production) return
12
-
13
- app.use((req, res, next) => {
14
- if (req.hostname !== APP_DOMAIN) {
15
- console.log("request from invalid hostname", {
16
- hostname: req.hostname,
17
- url: req.url
18
- })
19
- req.connection.destroy()
20
- } else {
21
- next()
22
- }
23
- })
24
- }
25
-
26
- module.exports = block_invalid_hosts