Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [Go] explicitlty listen on 127.0.0.1 to avoid firewall warning p… #427

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions go/core/servers.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@ func StartFlowServer(addr string) error {
// startDevServer always returns a non-nil error, the one returned by http.ListenAndServe.
func startDevServer(addr string) error {
slog.Info("starting dev server")
// Don't use "localhost" here. That only binds the IPv4 address, and the genkit tool
// wants to connect to the IPv6 address even when you tell it to use "localhost".
// Omitting the host works.
addr = serverAddress(addr, "GENKIT_REFLECTION_PORT", ":3100")
addr = serverAddress(addr, "GENKIT_REFLECTION_PORT", "127.0.0.1:3100")
mux := newDevServeMux(globalRegistry)
return listenAndServe(addr, mux)
}
Expand Down Expand Up @@ -248,7 +245,7 @@ type listFlowStatesResult struct {
// To construct a server with additional routes, use [NewFlowServeMux].
func startProdServer(addr string) error {
slog.Info("starting flow server")
addr = serverAddress(addr, "PORT", ":3400")
addr = serverAddress(addr, "PORT", "127.0.0.1:3400")
mux := NewFlowServeMux()
return listenAndServe(addr, mux)
}
Expand Down Expand Up @@ -308,7 +305,7 @@ func serverAddress(arg, envVar, defaultValue string) string {
return arg
}
if port := os.Getenv(envVar); port != "" {
return ":" + port
return "127.0.0.1:" + port
}
return defaultValue
}
Expand Down
Loading