diff --git a/lib/Downloader.js b/lib/Downloader.js index e782a328dc2..c7d161a47cd 100644 --- a/lib/Downloader.js +++ b/lib/Downloader.js @@ -272,7 +272,12 @@ function httpRequest(url, method, response) { } const driver = options.protocol === 'https:' ? 'https' : 'http'; - const request = require(driver).request(options, response); + const request = require(driver).request(options, res => { + if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) + httpRequest(res.headers.location, method, response); + else + response(res); + }); request.end(); return request; }