Comments (5)
The code used the resulting IP address of the given host string as the open url. I've now changed it in c94694b to use the user supplied string so that live-server --host=localhost
really opens the browser at literally the string "localhost".
from live-server.
👍
This affects how I load fonts and whitelisted domains in my font provider. 127.0.0.1
doesn’t load the fonts. localhost
does. I could change the whitelists for all of my font kits, but it would be much easier if this just worked out-of-the-box without having to manually change 127.0.0.1
to localhost
in the address bar. Otherwise the default open: true
feature gets in the way.
In the live-server/index.js
file, I see these relevant lines:
101 · LiveServer.start = function(options) {
…
103 · var host = options.host || '0.0.0.0';
…
136 · var address = server.address();
137 · var serveHost = address.address === "0.0.0.0" ? "127.0.0.1" : address.address;
138 · var serveURL = 'http://' + serveHost + ':' + address.port;
…
211 · };
Not sure the best way to fix this without a better understanding of why this is constructed this way to begin with, otherwise I would make a PR.
from live-server.
It was localhost
first, but it had problems (see #7). Apparantly there is no one address that works properly everywhere. :(
from live-server.
@tapio I get that different environments (OS and browsers) and use cases (http server, websockets, livereload, etc.) each have their own concerns and limitations so it’s prudent to provide a sane default, but I think this issue suggests an explicit host
value should not be converted back to one of the defaults (either 127.0.0.1
or 0.0.0.0
). It should be considered a bug if setting a host
value doesn’t work either as a command-line argument or in the ~/.live-server.json
.
from live-server.
@tapio ❤️
from live-server.
Related Issues (20)
- up to date alternative HOT 3
- It doesn't reload on changes HOT 2
- Prevent script injection in an iframe HOT 1
- liveReload no work in WSL2
- Does not load at all
- Live-server links to local files do not work HOT 6
- https not working properly
- How can I get live-server to work with URLs that are prepended with a base URL during production builds?
- Consider moving to esm and then build for cjs HOT 2
- Install anguar app but when refresh its coming 404 error, route not working
- 'live-server' is not recognized as the name
- Should entry file flag take precedence over the index file?
- On mac, installed live-server but the main script has CRLF line terminators HOT 2
- live-server watching .git directory changes HOT 1
- live-server very slow for some reason (like 3G network) HOT 1
- Browser doesn't refresh if script tag is added
- I can't install live-server! HOT 2
- No live reload on files with no <head> HOT 1
- liveserver issue
- Parameter Routes do not work with live-server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from live-server.