Self signed certificate
ntaylor-86 opened this issue · 2 comments
ntaylor-86 commented
Description
Hello, I'm sure this is possible I just couldn't find a reference to it in the docs.
How do you tell Roach to accept self signed certificates?
Cheers.
ksassnowski commented
You can configure options on the underlying Guzzle request using $request->addOption(string $name, mixed $value)
.
So you could write a request middleware that sets the verify
option on each outgoing request and then use that as a downloader middleware in you spider.
use RoachPHP\Downloader\Middleware\RequestMiddlewareInterface;
use RoachPHP\Http\Request;
use RoachPHP\Support\Configurable;
final class WithoutCertificateValidation implements RequestMiddlewareInterface
{
use Configurable;
public function handleRequest(Request $request): Request
{
// Completely disable SSL certificate verification.
return $request->addOption('verify', false);
}
}
ntaylor-86 commented
Thanks @ksassnowski 🙏