Skip to content

Commit

Permalink
Changed default ip for dev to * (#3733)
Browse files Browse the repository at this point in the history
  • Loading branch information
jspspike authored Sep 20, 2023
1 parent d72722f commit 7ba16cd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/shiny-rats-hide.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion packages/wrangler/src/__tests__/configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions packages/wrangler/src/__tests__/dev.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(`""`);
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/config/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ function normalizeAndValidateDev(
rawDev: RawDevConfig
): DevConfig {
const {
ip = "0.0.0.0",
ip = "*",
port,
inspector_port,
local_protocol = "http",
Expand Down

0 comments on commit 7ba16cd

Please sign in to comment.