mirror of
https://gitee.com/WeBank/fes.js.git
synced 2024-11-29 18:28:09 +08:00
fix: 代理插件兼容 array 写法 (#260)
Some checks are pending
Gitee Mirror / build (push) Waiting to run
Some checks are pending
Gitee Mirror / build (push) Waiting to run
This commit is contained in:
parent
b1ea675f40
commit
7c01ee979e
@ -6,8 +6,15 @@ const ASSET_EXT_NAMES = ['.ico', '.png', '.jpg', '.jpeg', '.gif', '.svg'];
|
||||
function proxyMiddleware(api) {
|
||||
return (req, res, next) => {
|
||||
const proxyConfig = api.config.proxy;
|
||||
if (proxyConfig && Object.keys(proxyConfig).some(path => req.url.startsWith(path))) {
|
||||
return next();
|
||||
if (proxyConfig) {
|
||||
if (Array.isArray(proxyConfig)) {
|
||||
if (proxyConfig.some(item => item.context.some(path => path && req.url.startsWith(path)))) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
else if (Object.keys(proxyConfig).some(path => req.url.startsWith(path))) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
if (ASSET_EXT_NAMES.includes(extname(req.url))) {
|
||||
return next();
|
||||
|
Loading…
Reference in New Issue
Block a user