-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Added new --host option and updated relevant tests #1482
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1482 +/- ##
=========================================
+ Coverage 86.41% 87.82% +1.4%
=========================================
Files 80 80
Lines 4585 4401 -184
=========================================
- Hits 3962 3865 -97
+ Misses 623 536 -87
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't the main issue with websockets?
@DeMoorJasper after doing some testing I'm not sure if websockets would be the main issue
|
@victor-cordova alright sounds good :) Just want to make sure @kwmiebach does this PR fix the original issue? |
Specifying host seems pretty useful 👌🏽 |
by default the server already listens on all hosts. is there a usecase to restrict that for some reason? |
@devongovett I believe the use case would be the one described here Comment. What do you think? |
there is already |
@devongovett completely right, sorry I missed that one. I'll close the PR. |
I did not find in my tests that the server listens by default on all interfaces. It only listens on localhost, which is normally 127.0.0.1. Btw. if it would do that, that would be a security issue. And shouldn't (But it could resolve a hostname to an IP address and listen on that IP address. Or it could listen on an interface but only answer requests with a specific hostname on that interface. The latter would only be necessary in specific development environments) |
@devongovett you said that already in another thread but it is not true. it only listens on localhost |
According to the node docs:
|
@devongovett thank you for looking into this. give me some time and I will repeat my tests |
I repeated my tests and I can confirm now that parcel listens on all interfaces. I was wrong, sorry for the confusion and work it cost some of you. But: Maybe the feature that @victor-cordova implemented in his pull request could still be useful. The default behaviour to listen on all interfaces could be seen as a security issue in some circumstances. In fact many development servers only listen to localhost by default. But at least it would now be possible to choose the interface where parcel listens, so a developer that does not want to expose the dev server to the whole network, could choose not to. And there is something I noticed: When you start parcel, it tells you it is only listening to localhost, which is wrong, as everybody knows now. This is definitely a security issue, because parcel listens to more interfaces than it tells you. Example:
This would be easy to fix here, where the string Line 121 in 3988ffc
|
@kwmiebach I agree this It has been requested a lot as well and if we close this again, I think the question will pop up again. I'm wondering however if we could merge |
I agree with @DeMoorJasper in that the new flag would be useful for security reasons. I'm not sure if merging the two options would be a good idea at this point. Mainly because it would be a breaking change for people already using |
Going to close this. The parcel server is not meant to be used in production. I don't really see why this feature would be useful for a development server. The |
I think this would be useful for cases that certain people have with running local servers on different hostnames. As you know @DeMoorJasper, certain use cases at large companies require a specific hostname, eg I'm hoping we can reconsider this PR -- would be helpful in reducing confusion! |
Hello! This PR should add the new option --host as requested on 1412. Based on the comments I assumed perhaps
HMRServer.js
had to be updated but after testing, that change seems unecessary.Rundown of my changes
How I tested
yarn build
in the host machine after changing the codebin\cli.js -p 999 --host <LOCAL_INTERFACE_IP> <SOME_LOCAL_ENTRY_POINT>
in the host machine