Skip to content

Commit 8b347cb

Browse files
committed
Drop Cookie header across domains.
Fixes #183
1 parent 6f5029a commit 8b347cb

File tree

2 files changed

+175
-182
lines changed

2 files changed

+175
-182
lines changed

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@ RedirectableRequest.prototype._processResponse = function (response) {
392392
var redirectUrlParts = url.parse(redirectUrl);
393393
Object.assign(this._options, redirectUrlParts);
394394

395-
// Drop the Authorization header if redirecting to another domain
395+
// Drop the confidential headers when redirecting to another domain
396396
if (!(redirectUrlParts.host === currentHost || isSubdomainOf(redirectUrlParts.host, currentHost))) {
397-
removeMatchingHeaders(/^authorization$/i, this._options.headers);
397+
removeMatchingHeaders(/^(?:authorization|cookie)$/i, this._options.headers);
398398
}
399399

400400
// Evaluate the beforeRedirect callback

0 commit comments

Comments
 (0)