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

Serve on both IPv4 and IPv6 interfaces by default #35

Closed
demurgos opened this issue Oct 26, 2017 · 5 comments
Closed

Serve on both IPv4 and IPv6 interfaces by default #35

demurgos opened this issue Oct 26, 2017 · 5 comments

Comments

@demurgos
Copy link
Contributor

Currently, hexo serve only listens to IPv4 intefaces. To get the IPv6 ::1, you have to pass it explicitly with the ip option (but then the server is not bound to the IPv4 interfaces).

Would it be possible to make hexo serve listen on all interfaces by default?

@NoahDragon
Copy link
Member

We recommend using apache or nginx as a server for the static website. The hexo-server is for debugging purpose, we don't plan to expand its functionality to reach a standard server level.

@demurgos
Copy link
Contributor Author

demurgos commented Nov 7, 2017

I use nginx on my production server, but wanted to use hexo serve for development (as intended). I use IPv6 for my localhost domains by defaults (it helps to spot these kind of errors). This is more a quality of life issue.

It's a pretty easy issue to solve: Node listens on all interfaces by default. I'll send a PR later this week when I'll have some time.

demurgos added a commit to demurgos/hexo-server that referenced this issue Nov 9, 2017
This commit changes the default value of the `--ip` option to use
Node's internal resolution. It means that it will try to bind to
the unspecified IPv6 address `::` if available or else fall back to the
unspecified IPv4 address `0.0.0.0`. In most systems, `::` also binds
to `0.0.0.0` which effectively allows to listen on all interfaces.

Closes hexojs#35
demurgos added a commit to demurgos/hexo-server that referenced this issue Nov 9, 2017
This commit changes the default value of the `--ip` option to use
Node's internal resolution. It means that it will try to bind to
the unspecified IPv6 address `::` if available or else fall back to the
unspecified IPv4 address `0.0.0.0`. In most systems, `::` also binds
to `0.0.0.0` which effectively allows to listen on all interfaces.

Closes hexojs#35
demurgos added a commit to demurgos/hexo-server that referenced this issue Nov 9, 2017
This commit changes the default value of the `--ip` option to use
Node's internal resolution. It means that it will try to bind to
the unspecified IPv6 address `::` if available or else fall back to the
unspecified IPv4 address `0.0.0.0`. In most systems, `::` also binds
to `0.0.0.0` which effectively allows to listen on all interfaces.

Closes hexojs#35
@demurgos
Copy link
Contributor Author

Would it be possible to push the updated version to npm?

@NoahDragon
Copy link
Member

@demurgos will do it shortly.

@NoahDragon
Copy link
Member

Done. Landed on npm.

demurgos added a commit to demurgos/hexo-server that referenced this issue Dec 22, 2017
This commit is a fix following the PR hexojs#39. This PR changed the
default behavior of the server to listen on all interfaces (both
IPv4 and IPv6). This commit was missing the update of the default
configuration, causing the server to still listen only to IPv4 by
default. The current commit fixes this error by using `undefined`
(Node's default) for the IP.

- See hexojs#35
- See hexojs#39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants