Sitelet https://github.com/jackma8ge8/anyproxy/commit/68188c9cd6e2db5e9e474af81e9fba6e90dc596a
Skip to content

Commit 68188c9

Browse files
author
xiaofeng.mxf
committed
1 parent 8951fb6 commit 68188c9

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎lib/requestHandler.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,15 @@ function getUserReqHandler(userRule, recorder) {
272272

273273
const host = req.headers.host;
274274
const protocol = (!!req.connection.encrypted && !(/^http:/).test(req.url)) ? 'https' : 'http';
275-
const fullUrl = protocol === 'http' ? req.url : (protocol + '://' + host + req.url);
275+
276+
// try find fullurl https://github.com/alibaba/anyproxy/issues/419
277+
let fullUrl = protocol + '://' + host + req.url;
278+
if (protocol === 'http') {
279+
const reqUrlPattern = url.parse(req.url);
280+
if (reqUrlPattern.host && reqUrlPattern.protocol) {
281+
fullUrl = req.url;
282+
}
283+
}
276284

277285
const urlPattern = url.parse(fullUrl);
278286
const path = urlPattern.path;

0 commit comments

Comments
 (0)