mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-24 08:41:31 +00:00
parent
7c2a161c0a
commit
1e8b61ac77
@ -223,7 +223,15 @@ function getUserReqHandler(userRule, recorder) {
|
||||
|
||||
const host = req.headers.host;
|
||||
const protocol = (!!req.connection.encrypted && !(/^http:/).test(req.url)) ? 'https' : 'http';
|
||||
const fullUrl = protocol === 'http' ? req.url : (protocol + '://' + host + req.url);
|
||||
|
||||
// try find fullurl https://github.com/alibaba/anyproxy/issues/419
|
||||
let fullUrl = protocol + '://' + host + req.url;
|
||||
if (protocol === 'http') {
|
||||
const reqUrlPattern = url.parse(req.url);
|
||||
if (reqUrlPattern.host && reqUrlPattern.protocol) {
|
||||
fullUrl = req.url;
|
||||
}
|
||||
}
|
||||
|
||||
const urlPattern = url.parse(fullUrl);
|
||||
const path = urlPattern.path;
|
||||
|
Loading…
x
Reference in New Issue
Block a user