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

Let liveReload script infer the port #8023

Open
hmoragrega opened this issue Dec 4, 2020 · 3 comments
Open

Let liveReload script infer the port #8023

hmoragrega opened this issue Dec 4, 2020 · 3 comments

Comments

@hmoragrega
Copy link

hmoragrega commented Dec 4, 2020

Hugo always forces a port when loading the liveReload javascript file if the feature is enabled

There's also the chance of manually setting the port with the flag liveReloadPort, but this means that we need to know the port beforehand and it's not always possible.

For example, with randomly assigned ports when running Hugo in docker, since the port is assigned when starting the container, this means that we cannot set liveReloadPort and the live reload JS will be invoked with port=1313 and thus fail.

Example:

docker run -d --rm --name hugo -p 1313 -v `pwd`/docs/hugo:/docs \
	gohugoio/hugo server -w --config /docs/config.toml --source /docs --bind 0.0.0.0

When loading the page the request to load the script includes the port

http://localhost:32871/api/v1/livereload.js?mindelay=10&v=2&port=1313&path=api/v1/livereload

But the container is not listening to it, and the feature fails

docker port hugo
1313/tcp -> 0.0.0.0:32871

Solution

There's no need to enforce a port always, if it's not passed the script will use the current host and port in the URL

This solves the issue by allowing users to specify if the port should not be passed by setting liveReloadPort to 0.

@bep bep added Enhancement and removed Proposal labels Dec 4, 2020
@bep bep added this to the v0.80 milestone Dec 4, 2020
@bep
Copy link
Member

bep commented Dec 4, 2020

You are right.

@bep bep modified the milestones: v0.80, v0.81 Jan 2, 2021
@bep bep modified the milestones: v0.81, v0.82 Feb 19, 2021
@bep bep modified the milestones: v0.82, v0.83 Mar 21, 2021
@bep bep modified the milestones: v0.83, v0.84 May 1, 2021
@bep bep modified the milestones: v0.84, v0.85 Jun 18, 2021
@bep bep modified the milestones: v0.85, v0.86 Jul 5, 2021
@bep bep modified the milestones: v0.86, v0.87, v0.88 Jul 26, 2021
@bep bep modified the milestones: v0.88, v0.89 Sep 2, 2021
@bep bep modified the milestones: v0.89, v0.90 Nov 2, 2021
@bep bep modified the milestones: v0.90, v0.91.0 Dec 13, 2021
@bep bep modified the milestones: v0.91.0, v0.92.0 Dec 22, 2021
@bep bep removed this from the v0.92.0 milestone Jan 12, 2022
@bep bep added this to the v0.113.0 milestone Apr 15, 2023
@bep bep modified the milestones: v0.113.0, v0.115.0 Jun 13, 2023
@bep bep modified the milestones: v0.115.0, v0.116.0 Jun 30, 2023
@bep bep modified the milestones: v0.116.0, v0.117.0 Aug 1, 2023
@bep bep modified the milestones: v0.117.0, v0.118.0 Aug 30, 2023
@bep bep modified the milestones: v0.118.0, v0.119.0 Sep 15, 2023
@bep bep modified the milestones: v0.119.0, v0.120.0 Oct 4, 2023
@bep bep modified the milestones: v0.120.0, v0.121.0 Oct 31, 2023
@bep bep modified the milestones: v0.121.0, v0.122.0 Dec 6, 2023
@bep bep modified the milestones: v0.122.0, v0.123.0, v0.124.0 Jan 27, 2024
@bep bep modified the milestones: v0.124.0, v0.125.0 Mar 4, 2024
@bep bep modified the milestones: v0.125.0, v0.126.0 Apr 23, 2024
@bep bep modified the milestones: v0.126.0, v0.127.0 May 15, 2024
@bep bep modified the milestones: v0.127.0, v0.128.0 Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants