Skip to content

Commit 08f4f18

Browse files
committed
Workaround a bug in localtunnel for CI tests
1 parent b55379d commit 08f4f18

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

smoke_test/vercel/test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use strict";
12
const { spawn } = require("node:child_process");
23
const fs = require("node:fs");
34
const fetch = require("node-fetch");
@@ -122,10 +123,13 @@ async function main() {
122123
console.info(`Creating a tunnel to ${url}...`);
123124
const tunnel = await localtunnel({
124125
port: url.port,
125-
local_host: url.hostname,
126+
// NOTE: if we specify `local_host`, `localtunnel` will try to rewrite the `Host` header in the
127+
// tunnelled HTTP requests. Unfortunately, they do it in a very silly way by converting the
128+
// tunnelled data to a string, thus corrupting the request body.
129+
//local_host: url.hostname,
126130
});
127131

128-
clientUrlInsideVercel = new URL(tunnel.url);
132+
let clientUrlInsideVercel = new URL(tunnel.url);
129133
if (url.protocol === "http:") {
130134
clientUrlInsideVercel.protocol = "https:";
131135
} else if (url.protocol === "ws:") {

smoke_test/workers/test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use strict";
12
const localtunnel = require("localtunnel");
23
const wrangler = require("wrangler");
34

@@ -15,7 +16,10 @@ async function main() {
1516
console.info(`Creating an tunnel to ${url}...`);
1617
tunnel = await localtunnel({
1718
port: url.port,
18-
local_host: url.hostname,
19+
// NOTE: if we specify `local_host`, `localtunnel` will try to rewrite the `Host` header in the
20+
// tunnelled HTTP requests. Unfortunately, they do it in a very silly way by converting the
21+
// tunnelled data to a string, thus corrupting the request body.
22+
//local_host: url.hostname,
1923
});
2024

2125
clientUrlInsideWorker = new URL(tunnel.url);

0 commit comments

Comments
 (0)