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

Make bind interface configurable, defaulting to 127.0.0.1 #1099

Closed
wants to merge 1 commit into from

Conversation

hut8
Copy link
Contributor

@hut8 hut8 commented May 2, 2015

Previously the server would always bind to all interfaces, which is weird since it's usually for testing. Resolves #1097 - also resolves some passive voice in help strings.

@bep
Copy link
Member

bep commented May 2, 2015

Thanks for this.

I'm not sure why I would want to do the below, but the log statement "Web Server is ..." is falsy below.

Could you fix that (amend the commit) -- and at the same time improve your commit message: split it in a title and body and end it with "Fixes #theid".

hugo server --baseUrl=bep2.local --bind=bep.local
...
Web Server is available at http://bep2.local:1313/
Press Ctrl+C to stop

@hut8
Copy link
Contributor Author

hut8 commented May 2, 2015

@bep Glad I can help! What is the solution to your conflict there? If "bind" is specified, it is likely to be "0.0.0.0" meaning "all interfaces." Of course the base URL should not be set to 0.0.0.0, right? But at the same time, we can't set the bind address to the base URL, since the base URL could contain components other than an address. So when there's a conflict between bind address and base URL, who "wins?"

@bep
Copy link
Member

bep commented May 2, 2015

The solution is to fix the log message. Should always use the value in bind.

@hut8
Copy link
Contributor Author

hut8 commented May 2, 2015

TIL that 0.0.0.0 can be used to connect to the local machine. Did not know that :) Updating patch now.

@bep bep added this to the v0.14 milestone May 3, 2015
@bep
Copy link
Member

bep commented May 3, 2015

@hut8 I don't see any updated patch ...?

Bind by default to 127.0.0.1. Previously it always bound to all interfaces.

Always have log message display that the server is available on the
interface to which it is bound, instead of the baseUrl.

Fixes gohugoio#1097
@hut8
Copy link
Contributor Author

hut8 commented May 4, 2015

Hang on, squashing commits, fixing commit messages and pushing...

@bep
Copy link
Member

bep commented May 7, 2015

OK, just ping me when done ...

@hut8
Copy link
Contributor Author

hut8 commented May 7, 2015

I forgot to reply to that before. I pushed the commits a while ago. Should be good now.
u.Host = serverInterface is the line I added to make the log message accurate.

@bep
Copy link
Member

bep commented May 7, 2015

Nah, my fault -- I looked at the changes, but didn't notice that part ... All good. Merged. Thanks.

@github-actions
Copy link

github-actions bot commented Mar 3, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web server listens on all interfaces and says it's on localhost
2 participants