I'm trying to configure the Redis config file in Laravel 8.75.0 (for cache purposes) to use TLS with a certificate authority certificate. At the moment, my config file looks like this (based on this answer: https://stackoverflow.com/a/48876398/10031033):
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'ssl' => ['cafile' => env('REDIS_CACHE_SSL_CA', null), 'verify_peer' => env('REDIS_CACHE_SSL_VerifyCA', false)]
],
'cache' => [
'scheme' => env('REDIS_CACHE_SCHEME', 'tcp'),
'host' => env('REDIS_CACHE_HOST', '127.0.0.1'),
'password' => env('REDIS_CACHE_PASSWORD', null),
'port' => env('REDIS_CACHE_PORT', 6379),
// 'database' => env('REDIS_CACHE_DB', 1),
],
I'm sure that the variables work and the connection works as the following config works perfectly.
$vm = array(
'host' => env('REDIS_CACHE_HOST'),
'port' => env('REDIS_CACHE_PORT'),
'timeout' => 0.8,
'scheme' => env('REDIS_CACHE_SCHEME'),
'ssl' => ['cafile' => env('REDIS_CACHE_SSL_CA'), 'verify_peer' => env('REDIS_CACHE_SSL_VerifyCA')],
);
$redis = new Client($vm);
$redis->auth(env('REDIS_CACHE_PASSWORD'));
try {
echo $redis->ping();
} catch (\Exception $e) {
// dd($e);
echo 'not';
}
Does anybody know what I'm doing wrong here? I've been trying for a couple of hours but can't seem to get it to work.
Thank you