Repository navigation
fix: correct func startup binding - #5484
Merged
Merged
Conversation
Change the local host binding for 'func start' from the IPv4 wildcard (0.0.0.0) to IPv4 loopback (127.0.0.1) for both the HTTP (UseUrls) and HTTPS (Kestrel Listen) paths, so the host is reachable only from localhost.
sarah (satvu)
approved these changes
Jul 17, 2026
Adds an opt-in --address CLI flag and matching local.settings.json Host.LocalHttpAddress setting to control the local IP the func host binds to. Defaults to 127.0.0.1 when unset. Precedence: CLI flag > config > 127.0.0.1. Both the HTTP listen URI and the HTTPS Kestrel listener now resolve the address through a shared ResolveBindAddress() helper, which validates the value and throws on invalid input. BaseUri remains localhost.
sarah (satvu)
approved these changes
Jul 28, 2026
Shyju Krishnankutty (kshyju)
approved these changes
Jul 28, 2026
Shyju Krishnankutty (kshyju)
left a comment
Member
There was a problem hiding this comment.
-
Release notes entry missing?
-
My agent review flagged this. Is this something we should mention in the "breaking change" docs?:
The 0.0.0.0 β 127.0.0.1 default change breaks a common workflow: running func start in a container and reaching it from the host via a mapped port (docker run -p 7071:7071, Compose, etc.). Docker forwards host traffic to the container's eth0, not loopback, so a loopback-only bind refuses those connections β a confusing "connection refused" on a port that's clearly mapped. Same for container-to-container and WSL2 β Windows host. This worked before with no flags; now it requires --address 0.0.0.0.
Documents the default bind change from 0.0.0.0 to 127.0.0.1, the new opt-in --address flag / Host.LocalHttpAddress setting, and the workaround for setups that relied on 0.0.0.0 (e.g. reaching the host from outside a Docker container).
Shyju Krishnankutty (kshyju)
approved these changes
Jul 29, 2026
4 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates
func startlocal host binding and makes the bind address configurable.Changes in
src/Cli/func/Actions/HostActions/StartHostAction.cs(andsrc/Cli/func/Common/HostStartSettings.cs):Setup()) and the HTTPS path (KestrelListen) bind to the IPv4 loopback address (127.0.0.1/IPAddress.Loopback).--addressflag: lets you specify the local IP address to bind to. When unset it defaults to127.0.0.1.local.settings.jsonsetting:Host.LocalHttpAddressprovides the same override via config.--addressflag βHost.LocalHttpAddressβ127.0.0.1.The address is resolved once via a shared
ResolveBindAddress()helper that validates the value and throws a clearCliExceptionon invalid input. It feeds both binding paths (the listen URI is built through anIPEndPointso IPv6 values are bracketed correctly).BaseUriand displayed function URLs remainlocalhost, so normal local development output is unchanged.Notes
http://localhost:{port}) are unaffected.NetworkHelpersand unrelated build assets are untouched.Validation
dotnet buildofsrc/Cli/funcsucceeds with 0 warnings / 0 errors.StartHostActionTests.cscover the default, the--addressoverride, the config-supplied value, and invalid-input handling β all pass.