From 7ba16cde200042830153f2648c4a8670071f1127 Mon Sep 17 00:00:00 2001 From: Joshua Johnson Date: Wed, 20 Sep 2023 11:35:32 -0500 Subject: [PATCH] Changed default ip for dev to * (#3733) --- .changeset/shiny-rats-hide.md | 5 +++++ packages/wrangler/src/__tests__/configuration.test.ts | 2 +- packages/wrangler/src/__tests__/dev.test.tsx | 6 +++--- packages/wrangler/src/config/config.ts | 2 +- packages/wrangler/src/config/validation.ts | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/shiny-rats-hide.md diff --git a/.changeset/shiny-rats-hide.md b/.changeset/shiny-rats-hide.md new file mode 100644 index 000000000000..f2cf1c2e1033 --- /dev/null +++ b/.changeset/shiny-rats-hide.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +Change local dev server default ip to `*` instead of `0.0.0.0`. This will cause the dev server to listen on both ipv4 and ipv6 interfaces diff --git a/packages/wrangler/src/__tests__/configuration.test.ts b/packages/wrangler/src/__tests__/configuration.test.ts index 4dc9b61271a2..0584e0b34ac9 100644 --- a/packages/wrangler/src/__tests__/configuration.test.ts +++ b/packages/wrangler/src/__tests__/configuration.test.ts @@ -28,7 +28,7 @@ describe("normalizeAndValidateConfig()", () => { d1_databases: [], constellation: [], dev: { - ip: "0.0.0.0", + ip: "*", local_protocol: "http", port: undefined, // the default of 8787 is set at runtime upstream_protocol: "https", diff --git a/packages/wrangler/src/__tests__/dev.test.tsx b/packages/wrangler/src/__tests__/dev.test.tsx index 66697720e1c3..b1b300f8daff 100644 --- a/packages/wrangler/src/__tests__/dev.test.tsx +++ b/packages/wrangler/src/__tests__/dev.test.tsx @@ -835,13 +835,13 @@ describe("wrangler dev", () => { }); describe("ip", () => { - it("should default ip to 0.0.0.0", async () => { + it("should default ip to *", async () => { writeWranglerToml({ main: "index.js", }); fs.writeFileSync("index.js", `export default {};`); await runWrangler("dev"); - expect((Dev as jest.Mock).mock.calls[0][0].initialIp).toEqual("0.0.0.0"); + expect((Dev as jest.Mock).mock.calls[0][0].initialIp).toEqual("*"); expect(std.out).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); expect(std.err).toMatchInlineSnapshot(`""`); @@ -1057,7 +1057,7 @@ describe("wrangler dev", () => { }); fs.writeFileSync("index.js", `export default {};`); await runWrangler("dev"); - expect((Dev as jest.Mock).mock.calls[0][0].initialIp).toEqual("0.0.0.0"); + expect((Dev as jest.Mock).mock.calls[0][0].initialIp).toEqual("*"); expect(std.out).toMatchInlineSnapshot(` "Your worker has access to the following bindings: - Durable Objects: diff --git a/packages/wrangler/src/config/config.ts b/packages/wrangler/src/config/config.ts index ce2300a2a4de..495e5e6d573e 100644 --- a/packages/wrangler/src/config/config.ts +++ b/packages/wrangler/src/config/config.ts @@ -187,7 +187,7 @@ export interface DevConfig { /** * IP address for the local dev server to listen on, * - * @default `0.0.0.0` + * @default `*` */ ip: string; diff --git a/packages/wrangler/src/config/validation.ts b/packages/wrangler/src/config/validation.ts index e7f5741d6765..4183bc48a4c1 100644 --- a/packages/wrangler/src/config/validation.ts +++ b/packages/wrangler/src/config/validation.ts @@ -392,7 +392,7 @@ function normalizeAndValidateDev( rawDev: RawDevConfig ): DevConfig { const { - ip = "0.0.0.0", + ip = "*", port, inspector_port, local_protocol = "http",