Skip to content

Commit a1be491

Browse files
fix: log request port instead since it's more relevant to the admin
Signed-off-by: Josh <josh.t.richards@gmail.com>
1 parent e07c89d commit a1be491

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/private/Http/Client/DnsPinMiddleware.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ public function addDnsPinning() {
110110
}
111111

112112
$hostName = (string)$request->getUri()->getHost();
113-
$port = $request->getUri()->getPort();
113+
$requestPort = $request->getUri()->getPort();
114114

115115
$ports = [
116116
'80',
117117
'443',
118118
];
119119

120-
if ($port !== null) {
121-
$ports[] = (string)$port;
120+
if ($requestPort !== null) {
121+
$ports[] = (string)$requestPort;
122122
}
123123

124124
$targetIps = $this->dnsResolve(idn_to_utf8($hostName), 0);
@@ -135,7 +135,8 @@ public function addDnsPinning() {
135135
foreach ($targetIps as $ip) {
136136
if ($this->ipAddressClassifier->isLocalAddress($ip)) {
137137
// TODO: continue with all non-local IPs?
138-
throw new LocalServerException('Host "' . $ip . '" (' . $hostName . ') violates local access rules');
138+
// log requestPort because that's more relevant to the admin
139+
throw new LocalServerException('Host "' . $ip . '" (' . $hostName . ':' . $requestPort . ') violates local access rules');
139140
}
140141
$curlResolves["$hostName:$port"][] = $ip;
141142
}

0 commit comments

Comments
 (0)