Skip to content

Emulator UI should not connect to 0.0.0.0 for emulators #286

@yuchenshi

Description

@yuchenshi

In firebase.json, it is possible to specify 0.0.0.0 for host for each emulator. This tells an emulator to listen on all IPv4 interfaces (including 127.0.0.1, the device's public network IP, etc.).

{
  // ...
  "emulators": {
    "firestore": {"host": "0.0.0.0", "port": 8080},
  }
}

However, with this setup, the Emulator UI attempts to send requests http://0.0.0.0:8080 to reach Firestore in the Firestore viewer. This is invalid since 0.0.0.0 is a non-routable address but some browsers / platforms (such as Chrome on Linux) special cases it to mean the same as 127.0.0.1. On other browsers / platforms (such as Chrome on Windows), this fails with errors like net::ERR_ADDRESS_INVALID.

Instead, the Emulator UI should change it to 127.0.0.1 when constructing the URL. Similarly, the Emulator UI should connect to ::1 (IPv6 local) when :: (IPv6 zero) is specified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions