Skip to content

binding to "0.0.0.0" startupMessage reports "127.0.0.1" 🐛  #1207

Closed
@gregchalmers

Description

@gregchalmers

Fiber version
v2.5.0

Issue description
If I bind Listen to "0.0.0.0" startupMessage reports "127.0.0.1", but OS says it's bound to "0.0.0.0".

Code snippet

package main
import "github.com/gofiber/fiber/v2"
func main() {
  app := fiber.New()
  log.Fatal(app.Listen("0.0.0.0:8080"))
}

netstat

$ netstat -lnp | grep LISTEN | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      189950/./main

output

 ┌───────────────────────────────────────────────────┐ 
 │                    Fiber v2.5.0                   │ 
 │               http://127.0.0.1:8080               │ 
 │                                                   │ 
 │ Handlers ............. 6  Processes ........... 1 │ 
 │ Prefork ....... Disabled  PID ............ 189363 │ 
 └───────────────────────────────────────────────────┘ 

code responsible in fiber/app.go

	host, port := parseAddr(addr)
	if host == "" || host == "0.0.0.0" {
		host = "127.0.0.1"
	}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions