优化是否绝对地址的判断。
parent
6062ace926
commit
698029c001
|
@ -33,7 +33,7 @@ function buildTargetUrl (rOptions, urlConf, interceptOpt, matched) {
|
|||
targetUrl = urlConf
|
||||
} else {
|
||||
let uri = rOptions.path
|
||||
if (uri.indexOf('http') === 0) {
|
||||
if (uri.indexOf('http:') === 0 || uri.indexOf('https:') === 0) {
|
||||
// eslint-disable-next-line node/no-deprecated-api
|
||||
const URL = url.parse(uri)
|
||||
uri = URL.path
|
||||
|
|
|
@ -83,7 +83,7 @@ module.exports = function createOverWallIntercept (overWallConfig) {
|
|||
const proxyTarget = domain + '/' + path + '/' + hostname + req.url
|
||||
|
||||
// const backup = interceptOpt.backup
|
||||
const proxy = proxyTarget.indexOf('http') === 0 ? proxyTarget : (rOptions.protocol + '//' + proxyTarget)
|
||||
const proxy = proxyTarget.indexOf('http:') === 0 || proxyTarget.indexOf('https:') === 0 ? proxyTarget : (rOptions.protocol + '//' + proxyTarget)
|
||||
// eslint-disable-next-line node/no-deprecated-api
|
||||
const URL = url.parse(proxy)
|
||||
rOptions.origional = lodash.cloneDeep(rOptions) // 备份原始请求参数
|
||||
|
|
Loading…
Reference in New Issue