Skip to content

Router doesn't listen op IPv6 addresses with wildcard configuration #1555

Open
@tobiasge

Description

@tobiasge

Bug Overview

When I configure a listener with *:8080 unitd only listens on 0.0.0.0:8080 and not on :::8080.
The documentation states the following: A wildcard that matches any host IPs on the port: *:80

Expected Behavior

unitd listens on all configured IP addresses.

Steps to Reproduce the Bug

Minimal configuration example:

{
  "listeners": {
    "*:8080": {
      "pass": "routes"
    },
    "0.0.0.0:8081": {
      "pass": "routes"
    },
    "[::]:8081": {
      "pass": "routes"
    }
  },
  "routes": [
    {
      "match": {
        "uri": [
          "/*"
        ]
      },
      "action": {
        "return": 200
      }
    }
  ]
}
netstat -plunt | grep unit
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      10435/unit: router
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      10435/unit: router
tcp6       0      0 :::8081                 :::*                    LISTEN      10435/unit: router
# curl -I http://127.0.0.1:8081/
HTTP/1.1 200 OK
Server: Unit/1.34.1
Date: Tue, 04 Feb 2025 15:40:21 GMT
Content-Length: 0


# curl -I http://[::1]:8081/
HTTP/1.1 200 OK
Server: Unit/1.34.1
Date: Tue, 04 Feb 2025 15:40:25 GMT
Content-Length: 0


# curl -I http://127.0.0.1:8080/
HTTP/1.1 200 OK
Server: Unit/1.34.1
Date: Tue, 04 Feb 2025 15:40:30 GMT
Content-Length: 0


# curl -I http://[::1]:8080/
curl: (7) Failed to connect to ::1 port 8080 after 0 ms: Couldn't connect to server

Environment Details

  • Target deployment platform: Linux Docker container
  • Target OS: Ubuntu 24.04
  • Version of this project or specific commit: 1.34.1
  • Version of any relevant project languages: -

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-EnhancementNew features and user-facing improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions