Skip to content

Commit

Permalink
ability to skip server certificate verification
Browse files Browse the repository at this point in the history
  • Loading branch information
arukompas committed Nov 11, 2024
1 parent 993492f commit a98ea0f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/log-viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
// 'username' => 'username',
// 'password' => 'password',
// ],
// 'verify_server_certificate' => true,
// ],
//
// 'production' => [
Expand All @@ -125,6 +126,7 @@
// 'headers' => [
// 'X-Foo' => 'Bar',
// ],
// 'verify_server_certificate' => true,
// ],
],

Expand Down
2 changes: 2 additions & 0 deletions src/Host.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function __construct(
public ?string $host = null,
public ?array $headers = null,
public ?array $auth = null,
public ?bool $verifyServerCertificate = true,
) {
$this->is_remote = $this->isRemote();
}
Expand All @@ -26,6 +27,7 @@ public static function fromConfig(string|int $identifier, array $config = []): s
$config['host'] ?? null,
$config['headers'] ?? [],
$config['auth'] ?? [],
$config['verify_server_certificate'] ?? true,
);
}

Expand Down
4 changes: 4 additions & 0 deletions src/Http/Middleware/ForwardRequestToHostMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public function handle(Request $request, Closure $next)
$proxyRequest = $proxyRequest->withDigestAuth($host->auth['username'], $host->auth['password']);
}

if (! $host->verifyServerCertificate) {
$proxyRequest = $proxyRequest->withoutVerifying();
}

$response = $proxyRequest->send($request->method(), $url);

return response(
Expand Down

0 comments on commit a98ea0f

Please sign in to comment.