Fiber bind address: 127.0.0.1 versus 0.0.0.0 behind a reverse proxy
0 reputation · 26 Mar 2024, 23:34 UTC
The goal is to run a Go Fiber service behind a reverse proxy on the same host while preventing direct external connections to the application. The proxy forwards public traffic, but the application must not accept traffic from outside the host.
In current Fiber releases, the listen address defaults to all interfaces when omitted. Binding to 127.0.0.1 limits reach to loopback, while 0.0.0.0 accepts traffic on every available interface. The correct value for fiber.Config.Addr must avoid breaking proxy forwarding or exposing the service unintentionally.
Does binding to 127.0.0.1 reliably prevent external access when the reverse proxy runs locally? Should 0.0.0.0 be used with firewall rules instead, or is loopback binding sufficient for this deployment pattern?