@abtnode/router-provider 1.8.62 → 1.8.63-beta-b71f5f80
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/lib/nginx/index.js +30 -6
- package/lib/util.js +1 -0
- package/package.json +6 -6
package/lib/nginx/index.js
CHANGED
|
@@ -206,7 +206,7 @@ class NginxProvider extends BaseProvider {
|
|
|
206
206
|
|
|
207
207
|
// eslint-disable-next-line no-restricted-syntax
|
|
208
208
|
for (const site of sites) {
|
|
209
|
-
const { domain, port, rules, corsAllowedOrigins } = site;
|
|
209
|
+
const { domain, port, rules, corsAllowedOrigins, blockletDid } = site;
|
|
210
210
|
const certificate = findCertificate(certificates, domain);
|
|
211
211
|
|
|
212
212
|
const parsedServerName = parseServerName(domain);
|
|
@@ -229,6 +229,7 @@ class NginxProvider extends BaseProvider {
|
|
|
229
229
|
corsAllowedOrigins,
|
|
230
230
|
daemonPort: nodeInfo.port,
|
|
231
231
|
commonHeaders,
|
|
232
|
+
blockletDid,
|
|
232
233
|
});
|
|
233
234
|
} else {
|
|
234
235
|
this._addHttpServer({
|
|
@@ -239,6 +240,7 @@ class NginxProvider extends BaseProvider {
|
|
|
239
240
|
port,
|
|
240
241
|
daemonPort: nodeInfo.port,
|
|
241
242
|
commonHeaders,
|
|
243
|
+
blockletDid,
|
|
242
244
|
});
|
|
243
245
|
}
|
|
244
246
|
}
|
|
@@ -546,10 +548,14 @@ class NginxProvider extends BaseProvider {
|
|
|
546
548
|
location._add('try_files', '$uri /404.html break');
|
|
547
549
|
}
|
|
548
550
|
|
|
549
|
-
_addGeneralProxyLocation({ server, port, prefix, suffix }) {
|
|
551
|
+
_addGeneralProxyLocation({ server, port, prefix, suffix, blockletDid }) {
|
|
550
552
|
server._add('location', concatPath(prefix, suffix));
|
|
551
553
|
const location = this._getLastLocation(server);
|
|
552
554
|
this._addCommonHeader(location);
|
|
555
|
+
location._add('include', 'includes/proxy');
|
|
556
|
+
if (blockletDid) {
|
|
557
|
+
location._add('proxy_set_header', `X-Blocklet-Did ${blockletDid}`);
|
|
558
|
+
}
|
|
553
559
|
|
|
554
560
|
location._add('proxy_pass', `http://${getUpstreamName(port)}`);
|
|
555
561
|
}
|
|
@@ -719,14 +725,32 @@ class NginxProvider extends BaseProvider {
|
|
|
719
725
|
: conf.nginx.stream.server;
|
|
720
726
|
}
|
|
721
727
|
|
|
722
|
-
_addHttpServer({
|
|
728
|
+
_addHttpServer({
|
|
729
|
+
locations = [],
|
|
730
|
+
serverName,
|
|
731
|
+
conf,
|
|
732
|
+
corsAllowedOrigins,
|
|
733
|
+
port,
|
|
734
|
+
daemonPort,
|
|
735
|
+
commonHeaders,
|
|
736
|
+
blockletDid,
|
|
737
|
+
}) {
|
|
723
738
|
const httpServerUnit = this._addHttpServerUnit({ conf, serverName, port });
|
|
724
739
|
this._addDefaultLocations(httpServerUnit, daemonPort);
|
|
725
740
|
// eslint-disable-next-line max-len
|
|
726
|
-
locations.forEach((x) => this._addReverseProxy({ server: httpServerUnit, ...x, serverName, corsAllowedOrigins, commonHeaders })); // prettier-ignore
|
|
741
|
+
locations.forEach((x) => this._addReverseProxy({ server: httpServerUnit, ...x, serverName, corsAllowedOrigins, commonHeaders, blockletDid })); // prettier-ignore
|
|
727
742
|
}
|
|
728
743
|
|
|
729
|
-
_addHttpsServer({
|
|
744
|
+
_addHttpsServer({
|
|
745
|
+
conf,
|
|
746
|
+
locations,
|
|
747
|
+
certificateFileName,
|
|
748
|
+
serverName,
|
|
749
|
+
corsAllowedOrigins,
|
|
750
|
+
daemonPort,
|
|
751
|
+
commonHeaders,
|
|
752
|
+
blockletDid,
|
|
753
|
+
}) {
|
|
730
754
|
const httpsServerUnit = this._addHttpsServerUnit({ conf, serverName, certificateFileName });
|
|
731
755
|
|
|
732
756
|
const httpServerUnit = this._addHttpServerUnit({ conf, serverName });
|
|
@@ -734,7 +758,7 @@ class NginxProvider extends BaseProvider {
|
|
|
734
758
|
|
|
735
759
|
this._addDefaultLocations(httpsServerUnit, daemonPort);
|
|
736
760
|
// eslint-disable-next-line max-len
|
|
737
|
-
locations.forEach((x) => this._addReverseProxy({ server: httpsServerUnit, ...x, serverName, corsAllowedOrigins, commonHeaders })); // prettier-ignore
|
|
761
|
+
locations.forEach((x) => this._addReverseProxy({ server: httpsServerUnit, ...x, serverName, corsAllowedOrigins, commonHeaders, blockletDid })); // prettier-ignore
|
|
738
762
|
}
|
|
739
763
|
|
|
740
764
|
_addHttpServerUnit({ conf, serverName, port }) {
|
package/lib/util.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/router-provider",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.63-beta-b71f5f80",
|
|
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.8.
|
|
36
|
-
"@abtnode/logger": "1.8.
|
|
37
|
-
"@abtnode/router-templates": "1.8.
|
|
38
|
-
"@abtnode/util": "1.8.
|
|
35
|
+
"@abtnode/constant": "1.8.63-beta-b71f5f80",
|
|
36
|
+
"@abtnode/logger": "1.8.63-beta-b71f5f80",
|
|
37
|
+
"@abtnode/router-templates": "1.8.63-beta-b71f5f80",
|
|
38
|
+
"@abtnode/util": "1.8.63-beta-b71f5f80",
|
|
39
39
|
"axios": "^0.27.2",
|
|
40
40
|
"debug": "^4.3.4",
|
|
41
41
|
"find-process": "^1.4.7",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"fs-extra": "^10.1.0",
|
|
63
63
|
"needle": "^3.1.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "ad50b6425a056b2db12b07283d0c08af62532c64"
|
|
66
66
|
}
|