z-song / laravel-admin

Build a full-featured administrative interface in ten minutes
https://laravel-admin.org
MIT License
11.15k stars 2.82k forks source link

Session Issue When Uploaded to Production #2343

Closed jandayanan closed 5 years ago

jandayanan commented 6 years ago

Description:

Production upload has problematic session when logging in, but local deployment works just fine. Tested this in multiple production deployments and subdomains. Any pointers as to what might be the issue?

image

.env file:

APP_NAME="Test App"
APP_ENV=local
APP_KEY=base64:xNQ6WupKGr1k+sadasdasdasd=
APP_DEBUG=true
APP_LOG_LEVEL=error
APP_URL=domain.com
COOKIE_DOMAIN=domain.com

# THIRD PARTY
GOOGLE_API_KEY=GOOGLE_API_KEY

DB_CONNECTION=mysql
DB_PORT=3306
DB_HOST=127.0.0.1
DB_DATABASE=app.db
DB_USERNAME=root
DB_PASSWORD=root

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=email@gmail.com
MAIL_PASSWORD=testpassword
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="email@gmail.com"
MAIL_FROM_NAME="Application Administrator"

PUSHER_APP_ID="asdasdsad"
PUSHER_APP_KEY="asdasdasd"
PUSHER_APP_SECRET="asdasdasdasd"
PUSHER_APP_CLUSTER=ap1

SESSION_DOMAIN=null
SESSION_DRIVER=file
SESSION_LIFETIME=120
SESSION_COOKIE=sdfghsdfgewrysdfgjhserfytsertsefgsdfgsert

API_PREFIX=api
API_SUBTYPE=app
API_VERSION=v1

SIGN_UP_RELEASE_TOKEN=false
PASSWORD_RESET_RELEASE_TOKEN=false

JWT_SECRET=my-dummy-token

Steps To Reproduce:

Can't reproduce this on your local.

z-song commented 6 years ago

Try to set the write permission of the session directory under storage/framework

jandayanan commented 6 years ago

Already did, and I can also see that the sessions are being written to the folder.

image

z-song commented 6 years ago

Maybe can find solution here https://github.com/laravel/framework/issues/23212

jandayanan commented 6 years ago

Already checked those possible fixes, nothing worked to be honest. I am not sure exactly what's the problem because my PHP configuration on my local machine is already almost the same as prod.

jandayanan commented 6 years ago

Update:

I noticed that this only happens when this exists: image

On my local machine, it doesn't show this redirect message once I go to web.app/admin

jandayanan commented 6 years ago

I am not sure though, maybe it's just redirecting faster in my local machine.

dhachayawat commented 6 years ago

After chmod

storage/framework/sessions

can fixed.