getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.6k stars 445 forks source link

Inconsistent bind address in serve vs auto #3652

Closed pavilo closed 1 year ago

pavilo commented 1 year ago

Environment

Python Version: Python 3.9.5 (default, May 12 2021, 20:44:22)

Nikola Version: Nikola v8.1.3 from the official docker container

Operating System: alpine in docker

Description:

This command binds to http://0.0.0.0:8000/

docker run --rm -ti -v $(pwd)/site:/nikola -p 8000:8000 --name nikola dragas/nikola:latest nikola serve

However if you replace serve with auto it now binds to http://127.0.0.1:8000/ inside the container and the site cannot be accessed outside of docker.

A quick fix is to append the -a 0.0.0.0 option.

Kwpolska commented 1 year ago

This is not a bug. nikola auto defaults to 127.0.0.1. Some of it might be related to security (to avoid exposing the websocket to the world), but also, I recall livereload sometimes having issues with unusual IPs. I don’t think we should change the default; if 0.0.0.0 works fine for your needs, then you can just pass that argument.