portless 0.9.2 → 0.9.4
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/dist/{chunk-YDICEMNW.js → chunk-63BOQNMU.js} +0 -25
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -301,29 +301,6 @@ function buildForwardedHeaders(req, tls) {
|
|
|
301
301
|
headers["x-forwarded-port"] = req.headers["x-forwarded-port"] || hostHeader.split(":")[1] || defaultPort;
|
|
302
302
|
return headers;
|
|
303
303
|
}
|
|
304
|
-
function rewriteOriginHeaders(headers, targetPort, tldSuffix, tld) {
|
|
305
|
-
const localOrigin = `http://localhost:${targetPort}`;
|
|
306
|
-
if (typeof headers.origin === "string") {
|
|
307
|
-
try {
|
|
308
|
-
const parsed = new URL(headers.origin);
|
|
309
|
-
if (parsed.hostname === tld || parsed.hostname.endsWith(tldSuffix)) {
|
|
310
|
-
headers.origin = localOrigin;
|
|
311
|
-
}
|
|
312
|
-
} catch {
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
if (typeof headers.referer === "string") {
|
|
316
|
-
try {
|
|
317
|
-
const parsed = new URL(headers.referer);
|
|
318
|
-
if (parsed.hostname === tld || parsed.hostname.endsWith(tldSuffix)) {
|
|
319
|
-
parsed.protocol = "http:";
|
|
320
|
-
parsed.host = `localhost:${targetPort}`;
|
|
321
|
-
headers.referer = parsed.toString();
|
|
322
|
-
}
|
|
323
|
-
} catch {
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
304
|
var PORTLESS_HOPS_HEADER = "x-portless-hops";
|
|
328
305
|
var MAX_PROXY_HOPS = 5;
|
|
329
306
|
function findRoute(routes, host, strict) {
|
|
@@ -396,7 +373,6 @@ function createProxyServer(options) {
|
|
|
396
373
|
delete proxyReqHeaders[key];
|
|
397
374
|
}
|
|
398
375
|
}
|
|
399
|
-
rewriteOriginHeaders(proxyReqHeaders, route.port, tldSuffix, tld);
|
|
400
376
|
const proxyReq = http.request(
|
|
401
377
|
{
|
|
402
378
|
hostname: "127.0.0.1",
|
|
@@ -480,7 +456,6 @@ function createProxyServer(options) {
|
|
|
480
456
|
delete proxyReqHeaders[key];
|
|
481
457
|
}
|
|
482
458
|
}
|
|
483
|
-
rewriteOriginHeaders(proxyReqHeaders, route.port, tldSuffix, tld);
|
|
484
459
|
const proxyReq = http.request({
|
|
485
460
|
hostname: "127.0.0.1",
|
|
486
461
|
port: route.port,
|
package/dist/cli.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
waitForProxy,
|
|
36
36
|
writeTldFile,
|
|
37
37
|
writeTlsMarker
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-63BOQNMU.js";
|
|
39
39
|
|
|
40
40
|
// src/colors.ts
|
|
41
41
|
function supportsColor() {
|
|
@@ -1427,7 +1427,7 @@ ${colors_default.bold("Reserved names:")}
|
|
|
1427
1427
|
process.exit(0);
|
|
1428
1428
|
}
|
|
1429
1429
|
function printVersion() {
|
|
1430
|
-
console.log("0.9.
|
|
1430
|
+
console.log("0.9.4");
|
|
1431
1431
|
process.exit(0);
|
|
1432
1432
|
}
|
|
1433
1433
|
async function handleTrust() {
|
package/dist/index.js
CHANGED