-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
diff --git a/lib/redirect.js b/lib/redirect.js | ||
index b9150e77c73d63367845c0aec15b5684d900943f..2864f9f2abc481ecf2b2dd96b1293f5b93393efd 100644 | ||
--- a/lib/redirect.js | ||
+++ b/lib/redirect.js | ||
@@ -14,6 +14,7 @@ function Redirect (request) { | ||
this.redirects = [] | ||
this.redirectsFollowed = 0 | ||
this.removeRefererHeader = false | ||
+ this.allowInsecureRedirect = false | ||
} | ||
|
||
Redirect.prototype.onRequest = function (options) { | ||
@@ -40,6 +41,9 @@ Redirect.prototype.onRequest = function (options) { | ||
if (options.followOriginalHttpMethod !== undefined) { | ||
self.followOriginalHttpMethod = options.followOriginalHttpMethod | ||
} | ||
+ if (options.allowInsecureRedirect !== undefined) { | ||
+ self.allowInsecureRedirect = options.allowInsecureRedirect | ||
+ } | ||
} | ||
|
||
Redirect.prototype.redirectTo = function (response) { | ||
@@ -108,7 +112,7 @@ Redirect.prototype.onResponse = function (response) { | ||
request.uri = url.parse(redirectTo) | ||
|
||
// handle the case where we change protocol from https to http or vice versa | ||
- if (request.uri.protocol !== uriPrev.protocol) { | ||
+ if (request.uri.protocol !== uriPrev.protocol && self.allowInsecureRedirect) { | ||
delete request.agent | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.