Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/http-proxy/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ export function toURL(url: URL | urllib.Url | ProxyTargetDetailed | string | und
if (url.startsWith("//")) {
// special case -- this would be viewed as a this is a "network-path reference",
// so we explicitly prefix with our http schema. See
url = `http://dummy.org${url}`;
url = `http://base.invalid${url}`;
}
// urllib.Url is deprecated but we support it by converting to URL
return new URL(url, "http://dummy.org");
return new URL(url, "http://base.invalid");
}

// vendor simplified version of https://www.npmjs.com/package/requires-port to
Expand Down
2 changes: 1 addition & 1 deletion lib/test/http/reverse-proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe("Reverse proxying -- create a server that...", () => {
server = http
.createServer((req, res) => {
log("Receiving reverse proxy request for:", req.url);
const urlObj = new URL(req.url ?? "", "http://dummy.org");
const urlObj = new URL(req.url ?? "", "http://base.invalid");
const target = urlObj.origin;
proxy.web(req, res, { target, secure: false });
})
Expand Down
18 changes: 9 additions & 9 deletions lib/test/lib/http-proxy-common.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL("http://dummy.org/some-path?a=1&b=2"),
target: new URL("http://base.invalid/some-path?a=1&b=2"),
},
{ url: "/src?s=1" },
);
Expand All @@ -311,7 +311,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL("http://dummy.org/some-path?a=1&b=2"),
target: new URL("http://base.invalid/some-path?a=1&b=2"),
ignorePath: true,
},
{ url: "/src?s=1" },
Expand All @@ -329,7 +329,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL("http://sometarget.com:80", "http://dummy.org"),
target: new URL("http://sometarget.com:80", "http://base.invalid"),
toProxy: true,
},
{ url: google },
Expand All @@ -344,7 +344,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL("http://sometarget.com:80", "http://dummy.org"),
target: new URL("http://sometarget.com:80", "http://base.invalid"),
toProxy: true,
},
{ url: google },
Expand All @@ -359,7 +359,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL("http://sometarget.com:80", "http://dummy.org"),
target: new URL("http://sometarget.com:80", "http://base.invalid"),
toProxy: true,
},
{ url: google },
Expand All @@ -375,7 +375,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL(myEndpoint, "http://dummy.org"),
target: new URL(myEndpoint, "http://base.invalid"),
ignorePath: true,
},
{ url: "/more/crazy/pathness" },
Expand All @@ -390,7 +390,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL(myEndpoint, "http://dummy.org"),
target: new URL(myEndpoint, "http://base.invalid"),
ignorePath: true,
prependPath: false,
},
Expand All @@ -408,7 +408,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL(myEndpoint, "http://dummy.org"),
target: new URL(myEndpoint, "http://base.invalid"),
changeOrigin: true,
},
{ url: "/" },
Expand Down Expand Up @@ -475,7 +475,7 @@ describe("#setupOutgoing", () => {
setupOutgoing(
outgoing,
{
target: new URL("https://whooooo.com", "http://dummy.org"),
target: new URL("https://whooooo.com", "http://base.invalid"),
method: "POST",
},
{ method: "GET", url: "" },
Expand Down
2 changes: 1 addition & 1 deletion lib/test/lib/http-proxy-passes-web-incoming.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ describe("#followRedirects", () => {
const source = http
.createServer((req, res) => {
if (
new URL(req.url ?? "", "http://dummy.org").pathname === "/redirect"
new URL(req.url ?? "", "http://base.invalid").pathname === "/redirect"
) {
res.writeHead(200, { "Content-Type": "text/plain" });
res.end("ok");
Expand Down