Skip to content

Commit 69a689b

Browse files
committed
Only set port in Host header if it's non-standard
1 parent 1c778b3 commit 69a689b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/XMLHttpRequest.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ exports.XMLHttpRequest = function() {
310310
var uri = url.pathname + (url.search ? url.search : '');
311311

312312
// Set the Host header or the server may reject the request
313-
headers["Host"] = host + ':' + url.port;
313+
headers["Host"] = host;
314+
if (!((ssl && port === 443) || port === 80)) {
315+
headers["Host"] += ':' + url.port;
316+
}
314317

315318
// Set Basic Auth if necessary
316319
if (settings.user) {

0 commit comments

Comments
 (0)