The Wayback Machine - https://web.archive.org/web/20250722045424/https://github.com/aspnet/Announcements/issues/185
Skip to content

Kestrel - Binding to localhost now binds to IPv4 and IPv6 loopback interfaces #185

@cesarblum

Description

@cesarblum

Configuring Kestrel to bind to localhost used to only bind to the IPv4 loopback interface. This caused confusion among users, especially those putting Kestrel behind reverse proxies that would see failures or delays because the proxies where trying to establish an IPv6 connection to Kestrel on localhost.

After change aspnet/KestrelHttpServer@a3d0bd0 when localhost is specified in the list of URLs for Kestrel to use, Kestrel will attempt to bind to both loopback interfaces. If one of them is not available due to any reason other than the address being in use by another service (e.g. IPv6 not enabled/supported), Kestrel logs a warning. However, if the requested port is in use by another service on either loopback interface, Kestrel will fail to start.

Binding to localhost:0 is not possible anymore after this change. To bind to dynamic ports on both loopback interfaces, you must explicitly bind to 127.0.0.1:0 and [::1]:0.

Discuss at aspnet/KestrelHttpServer#881.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions