-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix proxy bypass return false #1696
Fix proxy bypass return false #1696
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1696 +/- ##
==========================================
+ Coverage 83.76% 83.85% +0.09%
==========================================
Files 8 8
Lines 536 539 +3
Branches 161 162 +1
==========================================
+ Hits 449 452 +3
Misses 70 70
Partials 17 17
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.
Looks good, just question
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.
The suggested change (multiple nested ternaries and ifs) is too convoluted and has no code comments to help explain. No-one looking at this 5 minutes later would understand it 😨
@evilebottnawi @jshado1 thanks for the suggestions. I tried to make the logic more clear and simple. |
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.
🙌
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.
Good job!
…pack-dev-server into fix-proxy-bypass-return-false
@evilebottnawi I think you can merge this 😄 |
? proxyConfig.bypass(req, res, proxyConfig) | ||
: null; | ||
|
||
if (typeof bypassUrl === 'boolean') { |
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.
This is not aligning to the documentation
In the function you get access to the request, response and proxy options. It must return either false or a path that will be served instead of continuing to proxy the request.
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.
PR welcome to webpack docs
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.
For Bugs and Features; did you add new tests?
Yes
Motivation / Use-Case
Based on the explanation in the docs
It was expected that
return false
skip the proxy with a 404Breaking Changes
None
Additional Info
Closes #1677
/CC @evilebottnawi
@jsmith-sapient @jshado1 @evilebottnawi could you please test this manually and confirm that this have the intended behaviour?