I have 2 servers running same laravel app (laravel 5.3) and both are behind reverse proxy(nginx). for the session I set it to use redis. Also, I use cartalyst sentinel for user authentication.
let say the reverse Proxy is A, while servers for laravel are B and C.
The problem is:
When I log in A which is forwarding the request to B, and then the next request in A is forwarded to C.
When the request is forwarded to C, i can't pass the request because C see me as a guest not as an authenticate user.
how can I share session behind reverse proxy in different server?
config/cache.php
'default' => env('CACHE_DRIVER', 'redis'),
'stores' => [
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
config/session.php
'driver' => env('SESSION_DRIVER', 'redis'),
'connection' => 'session',
config/database.php
'redis' => [
'cluster' => false,
'default' => [
'host' => env('REDIS_HOST', '192.168.1.102'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'prefix' => env('REDIS_PREFIX', 'prod'),
],
'session' => [
'host' => env('REDIS_HOST', '192.168.1.102'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 1,
'prefix' => env('REDIS_PREFIX', 'prod_session'),
],
update: 11 Oct 2017
I try using laravel default Auth and it's work. from my view point the problem is in cartalyst sentinel that not ready for use in horizontal scaling server.