-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Fix proxy bypass return false #1696
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
Changes from 5 commits
41d4d18
53f1380
53bf54e
6c07574
6311172
07c7c59
e518fc5
5f3fa33
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -381,14 +381,22 @@ class Server { | |
| } | ||
| } | ||
|
|
||
| const bypass = typeof proxyConfig.bypass === 'function'; | ||
|
|
||
| const bypassUrl = | ||
| (bypass && proxyConfig.bypass(req, res, proxyConfig)) || false; | ||
|
|
||
| if (bypassUrl) { | ||
| // - Check if we have a bypass function defined | ||
| // - In case the bypass function is defined we'll retrieve the | ||
| // bypassUrl from it otherwise byPassUrl would be null | ||
| const isByPassFuncDefined = | ||
| typeof proxyConfig.bypass === 'function'; | ||
| const bypassUrl = isByPassFuncDefined | ||
| ? proxyConfig.bypass(req, res, proxyConfig) | ||
| : null; | ||
|
|
||
| if (typeof bypassUrl === 'boolean') { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not aligning to the documentation
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| // skip the proxy | ||
| req.url = null; | ||
| next(); | ||
| } else if (typeof bypassUrl === 'string') { | ||
| // byPass to that url | ||
| req.url = bypassUrl; | ||
|
|
||
| next(); | ||
| } else if (proxyMiddleware) { | ||
| return proxyMiddleware(req, res, next); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.