-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Hi,
I'm encountering an issue with local development using Docker where all site URLs are generated as http://0.0.0.0:4000, making the site inaccessible on Windows and some macOS browsers. This appears to be a direct consequence of PR #3029, which aimed to fix issue #3028.
Background:
Issue #3028 reported a problem where, when using Docker Compose or VS Code DevContainer, the site could be accessed locally (e.g., localhost:4000 or 0.0.0.0:4000), but internal links (navigation, CSS, JS) incorrectly pointed to the production URL (e.g., https://academicpages.github.io). This was due to Jekyll using the configured url instead of the local server address for asset URLs.
PR #3029 Changes:
To address this, PR #3029 made the following changes:
Removed the environment: JEKYLL_ENV=docker setting from the Docker Compose configuration.
Deleted the _config_docker.yml file (which contained url: "").
Changed the Jekyll serve command to jekyll serve -H 0.0.0.0 -w.
The intent was to force Jekyll into its default development mode, where it uses the --host argument (0.0.0.0 in this case) to generate URLs for assets and links.
Introduced Problem:
While this change successfully resolved the original issue for the PR author (who seemed to be on Linux, where 0.0.0.0 often resolves correctly in the browser), it introduced a significant cross-platform compatibility problem.
In development mode, Jekyll now uses 0.0.0.0 (from the -H 0.0.0.0 flag) as the base site.url. Consequently, all generated HTML links and asset URLs become http://0.0.0.0:4000/....
On Linux (Desktop): Browsers often interpret 0.0.0.0 as 127.0.0.1, so accessing http://0.0.0.0:4000 might work, masking the issue.
On Windows & macOS: Accessing http://0.0.0.0 directly in the browser typically fails or causes resource loading problems, as 0.0.0.0 is not a standard address for direct browser access. Users must specifically use http://localhost:4000 or http://127.0.0.1:4000, but the page content still references 0.0.0.0, leading to broken styles/scripts or security errors.
Analysis:
The deleted _config_docker.yml with url: "" was actually a safer approach for ensuring local links were relative or correctly overridden. The current solution prioritizes fixing one specific symptom (incorrect production URL usage) by hardcoding a host (0.0.0.0) that is not universally accessible as a browser address, breaking the experience for users on other operating systems.
Could we reconsider the fix from PR #3029 to ensure local development works reliably across Linux, Windows, and macOS? Perhaps reinstating a mechanism like _config_docker.yml or adjusting how the Jekyll environment is configured could resolve both the original issue #3028 and this new accessibility problem.
Thanks for your time and the great template!