Add option allow external connections to npx gulp server#20646
Add option allow external connections to npx gulp server#20646nicolo-ribaudo wants to merge 1 commit intomozilla:masterfrom
npx gulp server#20646Conversation
calixteman
left a comment
There was a problem hiding this comment.
You can add an option to handle whatever host:
https://github.com/mozilla/pdf.js/blob/master/gulpfile.mjs#L2096-L2144
5d167f5 to
d19e935
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #20646 +/- ##
=========================================
Coverage ? 62.82%
=========================================
Files ? 169
Lines ? 119819
Branches ? 0
=========================================
Hits ? 75271
Misses ? 44548
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
npx gulp servernpx gulp server
|
@calixteman Is this what you meant? |
I was imagining something like |
Using `0.0.0.0` instead of `localhost` allows connecting from other devices, significantly simplifying testing on mobile devices. This is controlled by the `--host` CLI flag and not enabled by default, since allowing external connections comes with security implications (e.g. when on a public network without a properly configured firewall). There might be reasons to want to listen on custom hostnames, but as the most common usage will probably be `--host 0.0.0.0`, there is a shorter alias `--host 0` for it.
d19e935 to
8730598
Compare
timvandermeij
left a comment
There was a problem hiding this comment.
Looks good to me; thanks!
|
|
||
| const { WebServer } = await import("./test/webserver.mjs"); | ||
| const server = new WebServer({ port }); | ||
| const server = new WebServer({ port, host }); |
There was a problem hiding this comment.
Nit: functionality-wise it doesn't really matter here, but when reading this I would expect the host to be listed before the port.
Using
0.0.0.0instead oflocalhostallows connecting from otherdevices, significantly simplifying testing on mobile devices.
This is controlled by the
--any-hostCLI flag and not enabled bydefault, since allowing external connections comes with security
implications (e.g. when on a public network without a properly
configured firewall).