Skip to content

Using TLS for Sessions with Heroku Redis 6  #1941

@outmost

Description

@outmost

Expected behaviour

Persist user sessions to Redis.

Actual behaviour

This is using Redis 6 on StackHero, which works perfectly:

        ini_set('session.save_handler', 'redis');
        ini_set('session.save_path', "tls://[HOST].stackhero-network.com:6380?auth=[PASSWORD]");

This is using Redis 6 on Heroku, which causes the error below:

        ini_set('session.save_handler', 'redis');
        ini_set('session.save_path', "tls://[HOST].eu-west-1.compute.amazonaws.com:21070?auth=[PASSWORD]");

Error message:

Warning: session_start(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed in /var/www/application/core/Session.php on line 19
Warning: session_start(): Failed to read session data: redis (path: tls://[HOST].eu-west-1.compute.amazonaws.com:21070?auth=[PASSWORD]) in /var/www/application/core/Session.php on line 19

I'm pretty certain it's down to Heroku Redis being self-signed certificates, but I'm not sure how to disable certificate verification / whether that's the right approach.

Thanks in advance for any pointers.

I'm seeing this behaviour on

  • OS: Heroku-20
  • Redis: 6
  • PHP: 7.4
  • phpredis: 5.3

Steps to reproduce, backtrace or example script

I've checked

  • There is no similar issue from other users
  • Issue isn't fixed in develop branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions