server-command
server-command copied to clipboard
Auto search new port if `8080` is busy
Will be great if server
command try to search other free port when 8080
is busy. I can send PR if you accept.
You can already define a custom port using --port=<port>
. Is there a particular reason why you think auto-discovery is needed? Also, what would be the side-effects we might introduce through that? Maybe automatically landing on a port that is open to the external web?
@schlessera
You can already define a custom port using --port=
. Is there a particular reason why you think auto-discovery is needed?
We use webpack-serve/php-server
in own development process (i.e. we have two development servers - webpack and php, we use proxy on webpack
dev server to php
server). By default webpack
dev server also try to use 8080
(but if they busy he search other free port). It is best practice and DX for development tools.
Also in some machines 8080
is already busy (example Apache behind nginx).
Solve problem for resolve free port on webpack
side (i.e. a lot of additional lines in configuration for simple action) is looks ugly and bad and increase config file (harder to read).
Also, what would be the side-effects we might introduce through that?
Don't think. It is easy implement.
Maybe automatically landing on a port that is open to the external web?
Don't think it is good solution. Development server should use internal ip/port for security reason
Solution http://php.net/manual/ru/function.socket-create-listen.php#44187
Maybe better add new option --auto-discover-port
for this behaviour (to not create breaking change)
Maybe automatically landing on a port that is open to the external web?
Don't think it is good solution. Development server should use internal ip/port for security reason
I think you misunderstood. I meant that that might happen when randomly selecting a port. Your random port might just happen to match an open port that with a pre-existing mapping.
So, if you already have a mapping to map port 8888 to the open external port 80, randomly selecting a port might just as well land on that exact 8888 and unwillingly expose your development server.
@schlessera for two servers - yes, but when you run only php webserver - not, it will be great feature anyway.