Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Updated local_server_start.go to display the correct listening IP in … #589

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
Loading
from
Open
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
7 changes: 6 additions & 1 deletion 7 commands/local_server_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,16 @@ var localServerStartCmd = &console.Command{
scheme = "http"
}

address := config.ListenIp
if address == "" {
address = "0.0.0.0"
}

msg := "Web server listening\n"
if p.PHPServer != nil {
msg += fmt.Sprintf(" The Web server is using %s %s\n", p.PHPServer.Version.ServerTypeName(), p.PHPServer.Version.Version)
}
msg += fmt.Sprintf("\n <href=%s://127.0.0.1:%d>%s://127.0.0.1:%d</>", scheme, port, scheme, port)
msg += fmt.Sprintf("\n <href=%s://%s:%d>%s://%s:%d</>", scheme, address, port, scheme, address, port)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this implementation will show an unreachable address when the address is 0.0.0.0 so I’m wondering if we should not display a completely different message in such case.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, true, this link would be broken, didn't even think of that.

Perhaps leave the href= set to localhost but display the 0.0.0.0 link text in such situations?
Alternatively, but a bit more complicated, use the host name/domain of the machine for the href= ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the hostname or domain seems fragile as they might not resolve to the IP selected by the user (and adds the complexity of discovering them for an edge case).

I believe it's best to use a different message or remove the link when we listen on all available IP.

(To be noted, we already show the domain names attached to the proxy)

if proxyConf, err := proxy.Load(homeDir); err == nil {
for _, domain := range proxyConf.GetDomains(projectDir) {
msg += fmt.Sprintf("\n <href=%s://%s>%s://%s</>", scheme, domain, scheme, domain)
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.