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

Jekyll Server >> Doesn't serve to host port expressly set, just localhost #5599

Closed
tim-bradley opened this Issue Nov 23, 2016 · 12 comments

Comments

Projects
None yet
5 participants
@tim-bradley

tim-bradley commented Nov 23, 2016

  • [ x] I believe this to be a bug, not a question about using Jekyll.
  • I updated to the latest Jekyll (or) if on GitHub Pages to the latest github-pages
  • I read the CONTRIBUTION file at https://jekyllrb.com/docs/contributing/
  • This is a feature request.

  • I am on (or have tested on) macOS 10+
  • I am on (or have tested on) Debian/Ubuntu GNU/Linux
  • I am on (or have tested on) Fedora GNU/Linux
  • I am on (or have tested on) Arch GNU/Linux
  • I am on (or have tested on) Other GNU/Linux
  • [x ] I am on (or have tested on) Windows 10+

  • I was trying to install.
  • There is a broken Plugin API.
  • I had an error on GitHub Pages, and I have reproduced it locally.
  • I had an error on GitHub Pages, and GitHub Support said it was a Jekyll Bug.
  • I had an error on GitHub Pages and I did not test it locally.
  • I was trying to build.
  • [x ] It was another bug.

My Reproduction Steps

I upgraded to 3.3.1 recently, which changed how jekyll server operated.

Prior to that, I was setting host to --host 0.0.0.0 in command line to access development site over my local network (to look at on mobile etc).

Since upgrade, setting host like that now causes problems and I note:

  1. Jekyll works fine when using on machine using localhost without setting host.
  2. When setting host to 0.0.0.0 (both in command line and in _config_dev.yml):
    2.1 I can load the html of the home page only - all other assets and links fail.
    2.2 But typing in the localhost address (127.0.0.1) allows me to access assets and and links.

I set up a copy of the site, and same result.

Perhaps someone could check to see if they can reproduce this error.

The Output I Wanted

When host is expressly set to 0.0.0.0, Jekyll server serves to 0.0.0.0.

/cc include any Jekyll affinity teams here (see https://teams.jekyllrb.com/ for more info)

@DirtyF

This comment has been minimized.

Member

DirtyF commented Nov 23, 2016

Everything is fine when running bundle exec jekyll serve --host 0.0.0.0 on OS X.

Could a Windows user give it a try?

@tim-bradley

This comment has been minimized.

tim-bradley commented Nov 23, 2016

I have done a new test install, initiated bundler (with the wdm gem 0.1.0) and executed bundle exec jekyll serve --host 0.0.0.0. Results were the same - seems to serve only over localhost port.

UPDATE: If I set it to the specific ip address (192.XXX.X.X) it works.

Still fails with the all ports.

I am happy with changing to use the specific port instead of using all ports.

Perhaps mark as resolved? Unless this is reproduced and/or this needs to be addressed?

I am not developer, so I don't know how important that is.

@ashmaroli

This comment has been minimized.

Member

ashmaroli commented Nov 23, 2016

I just tested this on a Windows 7 machine..

jekyll new tester 
cd tester
bundle exec jekyll serve --host 0.0.0.0
[..]
      Generating...
                    done in 1.123 seconds.
  Please add the following to your Gemfile to avoid polling for changes:
    gem 'wdm', '>= 0.1.0' if Gem.win_platform?
 Auto-regeneration: enabled
    Server address: http://0.0.0.0:4000/
  Server running... press ctrl-c to stop.

http://localhost:4000/
http://localhost:4000/jekyll/update/2016/11/23/welcome-to-jekyll.html
http://0.0.0.0:4000/

@ashmaroli

This comment has been minimized.

Member

ashmaroli commented Nov 23, 2016

@DirtyF if what I posted 👆 is what this issue is all about, then please remove the not-reproduced label

@ashmaroli

This comment has been minimized.

Member

ashmaroli commented Nov 23, 2016

@tim-bradley Since v3.3.0, one does not require a config_dev.yml to have a different url:, the server points to http://localhost:4000 by default.

Nevertheless, its a small bug, that IMHO, can be overlooked.. 😇

@tim-bradley

This comment has been minimized.

tim-bradley commented Nov 23, 2016

@ashmaroli - Yep. 100% agree. A small bug considering that I have been able to workaround it by putting in the direct network port (192.XXX.X.X) - I just didn't know if the all ports option (0.0.0.0) was relevant to real developers!
Thank you for the feedback!

@DirtyF DirtyF added bug windows and removed not-reproduced labels Nov 23, 2016

@parkr

This comment has been minimized.

Member

parkr commented Nov 29, 2016

Hey y'all, we added this feature in v3.3 because the jekyll serve server is meant for local development, meaning it should only be served by localhost (127.0.0.1). 0.0.0.0 is much too broad. Generated here and it's only overwritten when JEKYLL_ENV=development.

@tim-bradley

This comment has been minimized.

tim-bradley commented Nov 29, 2016

Thanks @parkr for that confirmation. I think I understand but may I ask for one clarification.
As I mentioned above, while I can't use 0.0.0.0 anymore, I do seem to be able to use the host option to point to my local network ip when doing the jekyll serve comment - which I understand sets JEKYLL_ENV=development by default.
That is expected, yes? We can use the --host option to set the local network ip when serving, just not the broader "lazy" option of 0.0.0.0?
I hope so because I often test my site locally on my phone, my brother's iphone and ipad (yes, he lives with me), etc - and need the ability to serve to the local network to do that rather than localhost.
I also hope I am making sense.

@ashmaroli

This comment has been minimized.

Member

ashmaroli commented Nov 29, 2016

As per documentation, the use of --host 0.0.0.0 should bind the server to http://0.0.0.0:4000/ and it seemingly does too, based on DirtyF's comment above, using a OS X system. Though I've haven't been successful using a Windows 7 system.
@tim-bradley, would your brother own a OS X system by any chance?

@tim-bradley

This comment has been minimized.

tim-bradley commented Nov 29, 2016

@ashmaroli - thanks for the reply.
HOST OPTION:
I think @parkr is saying that the host option for '0.0.0.0' should only work when the environment is production. When the environment is development, it overrides host to localhost but (hopefully) allows local network ips too.
Although maybe he means that when the environment is development, the host option doesn't work at all - and only localhost is useable.
I am not a coder, so I am out of my depth.
But perhaps the docs need updating to clarify this new change?
BROTHER - No, unfortunately. He just has devices.

@ashmaroli

This comment has been minimized.

Member

ashmaroli commented Nov 29, 2016

@tim-bradley What Parker meant was that since v3.3 the webkit serves only at the localhost:4000 by default instead of earlier broader-spectrum..
My issue here is Why --host 0.0.0.0 binds correctly to http://0.0.0.0:4000/ on OS X and not on Windows.

@jekyllbot

This comment has been minimized.

Contributor

jekyllbot commented Jan 23, 2017

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the 3.3-stable or master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider building it first as a plugin. Jekyll 3 introduced hooks which provide convenient access points throughout the Jekyll build pipeline whereby most needs can be fulfilled. If this is something that cannot be built as a plugin, then please provide more information about why in order to keep this issue open.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment