stoat.run 0.1.0 → 0.1.2
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/bin.cjs +15 -2
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -129,8 +129,13 @@ var LocalProxy = class {
|
|
|
129
129
|
try {
|
|
130
130
|
const headers = {};
|
|
131
131
|
for (const [k, v] of Object.entries(meta.headers)) {
|
|
132
|
-
headers[k] = Array.isArray(v) ? v.join(", ") : v;
|
|
132
|
+
headers[k.toLowerCase()] = Array.isArray(v) ? v.join(", ") : v;
|
|
133
133
|
}
|
|
134
|
+
const forwardedHost = headers["host"]?.split(",")[0]?.trim();
|
|
135
|
+
if (forwardedHost) {
|
|
136
|
+
headers["x-forwarded-host"] = forwardedHost;
|
|
137
|
+
}
|
|
138
|
+
headers["x-forwarded-proto"] = "https";
|
|
134
139
|
const { statusCode, headers: resHeaders, body } = await (0, import_undici.request)(url, {
|
|
135
140
|
method: meta.method,
|
|
136
141
|
headers,
|
|
@@ -613,6 +618,7 @@ async function httpCommand(port, options) {
|
|
|
613
618
|
pid: process.pid,
|
|
614
619
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
615
620
|
});
|
|
621
|
+
let interactive = null;
|
|
616
622
|
const tunnel = new TunnelClient({
|
|
617
623
|
edgeUrl,
|
|
618
624
|
slug,
|
|
@@ -625,9 +631,16 @@ async function httpCommand(port, options) {
|
|
|
625
631
|
if (payload.reason === "session_expired") {
|
|
626
632
|
clearSession();
|
|
627
633
|
}
|
|
634
|
+
if (payload.reason === "closed_by_overlay") {
|
|
635
|
+
process.stdout.write(" Tunnel closed from overlay\n");
|
|
636
|
+
tunnel.stop();
|
|
637
|
+
clearSession();
|
|
638
|
+
interactive?.stop();
|
|
639
|
+
process.exit(0);
|
|
640
|
+
}
|
|
628
641
|
}
|
|
629
642
|
});
|
|
630
|
-
|
|
643
|
+
interactive = new InteractiveMode({
|
|
631
644
|
publicUrl,
|
|
632
645
|
tunnel,
|
|
633
646
|
onQuit: () => {
|