-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add 'allowedHosts' option #899
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #899 +/- ##
==========================================
+ Coverage 71.3% 72.23% +0.93%
==========================================
Files 4 4
Lines 453 461 +8
Branches 133 138 +5
==========================================
+ Hits 323 333 +10
+ Misses 130 128 -2
Continue to review full report at Codecov.
|
Django docs say:
Could this be added as well? |
@mgol I didn't realize that there were already a few tests for I can either add tests for |
@orteth01 I guess it makes sense to nest that under existing tests (a separate inner Note, though, that I'm just a user, not a member of Webpack's core team so you might want to wait for someone on the team to decide. I'm just providing my own feedback. |
Yea that makes more sense, I think. I've gone with that option. thanks, @mgol |
2658f96
to
5f3924a
Compare
There seem to be a few open issues that this PR would remedy. Any thoughts, @SpaceK33z ?? |
What's the status on this? |
@ssilve1989 waiting on review from one of Webpack's core team members |
@SpaceK33z @sokra I hate to be that guy, but this is preventing us from moving to a more secure setup -- The entire point of the change that prompted this PR. Can we please get movement? I am happy to assist if I can. |
Can I put an IP address with wildcards in here too? I sometimes get new IP from DHCP and I would like to share my current work with my collegues (just open a browser). Can this be done without me registering a local private domain? |
Currently, you can add an ip address as an allowed host but not with wildcards. Only the subdomain wildcard is supported, meaning that only the first part of your allowed host can be dynamic. In theory I guess you could have something like this
which would allow any IP's that take the form |
@orteth01 For IPs I'd expect a wildcard going in a different direction, e.g. |
@mgol Would adding this wildcard be secure? I can certainly add support for a wildcard at the end of a specified host I just want to make sure that it is safe to do so. |
As I mentioned in some of the other threads, it should be safe to whitelist all IP-addresses-like hosts names by default, which would save people having to whitelist them manually. |
@edmorley it seems like a separate PR would be appropriate for that. I'll create an issue. |
@orteth01 merged the PR, as its a solid feature and has been in waiting for quite some time, but we still need example/readme updates for this. we've got a little bit of time before we release, would be great if you would be able to add that. |
@shellscape I'm more than happy to help with documentation! I'm assuming that I should update this readme. Are there any other places where I should add information regarding this feature? |
@orteth01 awesome. yes, please do update that readme. It's also suggested to create an example directory to demo the option. |
Can this be set via command line? |
@Mario-Eis not currently. i'll try to get a PR open by the end of the week. |
What kind of change does this PR introduce?
feature/bugfix
Did you add or update the
examples/
?no
Summary
Host checking was added by default in v2.4.3 for security reasons. Users now have to specify the host/URL being used to access the dev-server more info here
This PR allows users to specify multiple hosts that that will pass the check. Recommended by @edmorley here: #882 (comment)
Does this PR introduce a breaking change?
no
Example usage in webpack config:
subdomain wildcard:
mimicking django's
ALLOWED_HOSTS
, a value beginning with "." can be used as a subdomain wildcard. '.example.com' will match example.com, www.example.com, and any other subdomain of example.com.