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

Auto search new port if 8080 is busy #40

Open
alexander-akait opened this issue Jul 18, 2018 · 4 comments
Open

Auto search new port if 8080 is busy #40

alexander-akait opened this issue Jul 18, 2018 · 4 comments

Comments

@alexander-akait
Copy link

Will be great if server command try to search other free port when 8080 is busy. I can send PR if you accept.

@schlessera
Copy link
Member

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?

@alexander-akait
Copy link
Author

@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)

@schlessera
Copy link
Member

schlessera commented Jul 18, 2018

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.

@alexander-akait
Copy link
Author

@schlessera for two servers - yes, but when you run only php webserver - not, it will be great feature anyway.

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

2 participants