mirror of
https://github.com/http-party/node-http-proxy.git
synced 2026-02-01 17:46:18 +00:00
[fix] Ensure response.headers.location is defined. Fixes #276.
This commit is contained in:
parent
deca7565c5
commit
013cb2e0c2
@ -247,7 +247,8 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
|
||||
delete response.headers['transfer-encoding'];
|
||||
}
|
||||
|
||||
if ((response.statusCode === 301) || (response.statusCode === 302)) {
|
||||
if ((response.statusCode === 301) || (response.statusCode === 302)
|
||||
&& typeof response.headers.location !== 'undefined') {
|
||||
if (self.source.https && !self.target.https) {
|
||||
response.headers.location = response.headers.location.replace(/^http\:/, 'https:');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user