@abtnode/router-provider 1.16.15-beta-d8e7b6c0 → 1.16.15-beta-9318a201

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.
@@ -469,6 +469,7 @@ class NginxProvider extends BaseProvider {
469
469
  server,
470
470
  serverName,
471
471
  port,
472
+ root,
472
473
  prefix,
473
474
  groupPrefix,
474
475
  suffix,
@@ -483,7 +484,7 @@ class NginxProvider extends BaseProvider {
483
484
  cacheGroup,
484
485
  pageGroup,
485
486
  }) {
486
- server._add('location', concatPath(prefix, suffix));
487
+ server._add('location', concatPath(prefix, suffix, root));
487
488
 
488
489
  const location = this._getLastLocation(server);
489
490
 
package/lib/util.js CHANGED
@@ -37,7 +37,11 @@ const trimEndSlash = (str) => {
37
37
  return str;
38
38
  };
39
39
 
40
- const concatPath = (prefix = '', suffix = '') => {
40
+ const concatPath = (prefix = '', suffix = '', root = false) => {
41
+ if (root && suffix) {
42
+ return suffix ? `~* ^${suffix}$` : '/';
43
+ }
44
+
41
45
  if (prefix === '/') {
42
46
  return suffix ? `~* .*${suffix}$` : '/';
43
47
  }
@@ -88,6 +92,7 @@ const formatRoutingTable = (routingTable) => {
88
92
  groupPrefix,
89
93
  suffix,
90
94
  response: x.to.response,
95
+ root: !!x.from.root, // do not use x.from.pathPrefix when generate rule
91
96
  };
92
97
  if (x.to.type === ROUTING_RULE_TYPES.REDIRECT) {
93
98
  rule.redirectCode = x.to.redirectCode || 302;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/router-provider",
3
- "version": "1.16.15-beta-d8e7b6c0",
3
+ "version": "1.16.15-beta-9318a201",
4
4
  "description": "Routing engine implementations for abt node",
5
5
  "author": "polunzh <polunzh@gmail.com>",
6
6
  "homepage": "https://github.com/ArcBlock/blocklet-server#readme",
@@ -32,10 +32,10 @@
32
32
  "url": "https://github.com/ArcBlock/blocklet-server/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@abtnode/constant": "1.16.15-beta-d8e7b6c0",
36
- "@abtnode/logger": "1.16.15-beta-d8e7b6c0",
37
- "@abtnode/router-templates": "1.16.15-beta-d8e7b6c0",
38
- "@abtnode/util": "1.16.15-beta-d8e7b6c0",
35
+ "@abtnode/constant": "1.16.15-beta-9318a201",
36
+ "@abtnode/logger": "1.16.15-beta-9318a201",
37
+ "@abtnode/router-templates": "1.16.15-beta-9318a201",
38
+ "@abtnode/util": "1.16.15-beta-9318a201",
39
39
  "@arcblock/http-proxy": "^1.19.1",
40
40
  "axios": "^0.27.2",
41
41
  "debug": "^4.3.4",
@@ -59,5 +59,5 @@
59
59
  "bluebird": "^3.7.2",
60
60
  "fs-extra": "^10.1.0"
61
61
  },
62
- "gitHead": "87ebe2e8267e634e2217d7ca28231d0b01636ae6"
62
+ "gitHead": "f3722cbd4fe10c5fa083cad7e859ecff6095060d"
63
63
  }