Skip to content

Commit a98ea0f

Browse files
committed
ability to skip server certificate verification
1 parent 993492f commit a98ea0f

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

config/log-viewer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
// 'username' => 'username',
115115
// 'password' => 'password',
116116
// ],
117+
// 'verify_server_certificate' => true,
117118
// ],
118119
//
119120
// 'production' => [
@@ -125,6 +126,7 @@
125126
// 'headers' => [
126127
// 'X-Foo' => 'Bar',
127128
// ],
129+
// 'verify_server_certificate' => true,
128130
// ],
129131
],
130132

src/Host.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public function __construct(
1414
public ?string $host = null,
1515
public ?array $headers = null,
1616
public ?array $auth = null,
17+
public ?bool $verifyServerCertificate = true,
1718
) {
1819
$this->is_remote = $this->isRemote();
1920
}
@@ -26,6 +27,7 @@ public static function fromConfig(string|int $identifier, array $config = []): s
2627
$config['host'] ?? null,
2728
$config['headers'] ?? [],
2829
$config['auth'] ?? [],
30+
$config['verify_server_certificate'] ?? true,
2931
);
3032
}
3133

src/Http/Middleware/ForwardRequestToHostMiddleware.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ public function handle(Request $request, Closure $next)
3636
$proxyRequest = $proxyRequest->withDigestAuth($host->auth['username'], $host->auth['password']);
3737
}
3838

39+
if (! $host->verifyServerCertificate) {
40+
$proxyRequest = $proxyRequest->withoutVerifying();
41+
}
42+
3943
$response = $proxyRequest->send($request->method(), $url);
4044

4145
return response(

0 commit comments

Comments
 (0)