bmustiata / fast-live-reload

A live reload that works with all the possible browsers.
18 stars 5 forks source link

Host from request is not used to determine live reload host #6

Closed tvanekeris closed 7 years ago

tvanekeris commented 7 years ago

Hi,

first of all: many thanks for your work, fast-live-reload is awesome.

Setup

I run fast-live-reload in a Docker container so that I request the pages not from localhost but from 192.168.99.100.

I run flr using flr -sp 8000 -s build grunt/livereload in the Docker container so that content from the build directory is served and flr watches for changes in another directory.

Bug description

Everything works correctly when run locally on the system (not within a Docker container), so the bug is related to a different host string than localhost.

The (potential) bug is in the UpdateNotifier class around line 31. The hostString is correctly determined from the request (from document.location.href) to be 192.168.99.100 but never used afterwards. This results in the WebSocket to be opened (wrongly) to the default host localhost:9001 instead of the correct 192.168.99.100:9001. When I hard-code the correct host string in line 41 after all the automatic determination, everything works as expected.

Solution

I did not directly fix this in code because I am not sure how exactly the different ways of specifying the fastLiveReloadHost value should be prioritized. But I am pretty sure that without giving any additional parameter (e.g., you describe the way via GET parameters in the docs), the already correctly determined hostString should be used somehow.

bmustiata commented 7 years ago

Thank you for the detailed bug report and the kind words. I'll check it tonight.

tvanekeris commented 7 years ago

Many thanks @bmustiata, this was really fast and it works (directly tested)!

bmustiata commented 7 years ago

Well, it's easy when you show me exactly where to fix. ;)

On May 10, 2017 4:59 PM, "Tilo van Ekeris" notifications@github.com wrote:

Many thanks @bmustiata https://github.com/bmustiata, this was really fast and it works (directly tested)!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bmustiata/fast-live-reload/issues/6#issuecomment-300509637, or mute the thread https://github.com/notifications/unsubscribe-auth/AAb8iqjnt-qX_04F7BO1asKYU1BXL65yks5r4dC6gaJpZM4NWdBd .