bdy 1.9.41-dev → 1.9.42-dev
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/distTs/package.json +1 -1
- package/distTs/src/tunnel/http.js +8 -0
- package/package.json +1 -1
package/distTs/package.json
CHANGED
|
@@ -94,6 +94,13 @@ class TunnelHttp extends events_1.default {
|
|
|
94
94
|
h += `:${this.port}`;
|
|
95
95
|
return punycode_js_1.default.toASCII(h);
|
|
96
96
|
}
|
|
97
|
+
getForwardedHost() {
|
|
98
|
+
if (this.req.headers.host)
|
|
99
|
+
return this.req.headers.host;
|
|
100
|
+
if (this.req.headers[':authority'])
|
|
101
|
+
return this.req.headers[':authority'];
|
|
102
|
+
return 'localhost';
|
|
103
|
+
}
|
|
97
104
|
getRequestHeaders(http2) {
|
|
98
105
|
const h = {};
|
|
99
106
|
let ip;
|
|
@@ -116,6 +123,7 @@ class TunnelHttp extends events_1.default {
|
|
|
116
123
|
}
|
|
117
124
|
h['x-forwarded-for'] = ip || '0.0.0.0';
|
|
118
125
|
h['x-forwarded-proto'] = 'https';
|
|
126
|
+
h['x-forwarded-host'] = this.getForwardedHost();
|
|
119
127
|
if (this.auth) {
|
|
120
128
|
h['authorization'] = `Basic ${Buffer.from(this.auth).toString('base64')}`;
|
|
121
129
|
}
|