I'm experiencing the error:
could not find driver (SQL: select * from sessions where id = Kz9rXIxivkq0sVfLu4ypMLQA3ePNZccHjsRZUhml limit 1)
see image
Migrations are running fine which is strange. Here is my php -m output:
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
SimpleXML
sockets
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib
[Zend Modules]
Also for some reason, all PHP scripts are running very slowly, even simple ones (php -v, php --ini). Application is running on nginx server.
Does anyone know how to resolve this? Thank you very much in advance!
EDIT
session.php
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 240),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc", "memcached", or "dynamodb" session drivers you may
| list a cache store that should be used for these sessions. This value
| must match with one of the application's configured cache "stores".
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [100, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,
];
enter code here
enter code here
.env
APP_NAME=LARAVEL
APP_ENV=development
APP_KEY=base64:MEw1jEc7qyYhz4vIgxpZIqbURtoQ67HS6KsSBajwMC0=
APP_DEBUG=true
APP_URL=127.0.0.1
LOG_CHANNEL=single
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=app_prod
DB_USERNAME=root
DB_PASSWORD=SomePassword
#SESSION_SECURE_COOKIE=true
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=anonymous-database
SESSION_LIFETIME=120
ACCESS_ALLOW_IP=
ACCESS_ALLOW_IP_ON=false
Managed finally to fix it. I just did yum -y remove php* and installed everything again.
Yeah as defined in your .env file you have defined the SESSION_DRIVER to anonymous_database it must be file or mysql or any prefered database driver. As your program is trying to retrieve session from database there must be a table of sessions present there.
For the proper session table schema it is defined in : https://laravel.com/docs/6.x/session#driver-prerequisites
Related
I am using php-open-source-saver/jwt-auth for authentication in Laravel and I am trying to use private and public key but I can't use .pem files in .env
With the command php artisan jwt:generate-certs generate 2 files inside storage/certs
Those files I need to use in .env
.env file I have:
#JWT
JWT_TTL=null
JWT_ALGO=ES256
JWT_SHOW_BLACKLIST_EXCEPTION=true
JWT_PASSPHRASE=
JWT_PRIVATE_KEY= ##### HERE SHOULD BE .PEM #####
JWT_PUBLIC_KEY=. ##### HERE SHOULD BE .PEM #####
And inside config/jwt.php has
/*
|--------------------------------------------------------------------------
| Public Key
|--------------------------------------------------------------------------
|
| A path or resource to your public key.
|
| E.g. 'file://path/to/public/key'
|
*/
'public' => env('JWT_PUBLIC_KEY'),
/*
|--------------------------------------------------------------------------
| Private Key
|--------------------------------------------------------------------------
|
| A path or resource to your private key.
|
| E.g. 'file://path/to/private/key'
|
*/
'private' => env('JWT_PRIVATE_KEY'),
/*
|--------------------------------------------------------------------------
| Passphrase
|--------------------------------------------------------------------------
|
| The passphrase for your private key. Can be null if none set.
|
*/
'passphrase' => env('JWT_PASSPHRASE'),
I'm trying to set up laravel horizon to run on my google cloud (run) containers. I have gotten installed successfully, however when I navigate to the dashboard, it always indicates to be inactive. Jobs are getting scheduled but are not being executed.
For clarification:
The laravel application also houses an application on which actual end-users end up. I want to add Horizon to manage the jobs that are generated by that platform. It's a serverless application (housed on Cloud Run as mentioned), however there are atleast 3 containers running at all times and the Redis instance which powers the queue is also housed seperately.
Dockerfile:
FROM composer:2.1.3 as build
WORKDIR /app
COPY . /app
RUN apk update
RUN apk add libpng libpng-dev libjpeg-turbo-dev supervisor libwebp-dev zlib-dev libxpm-dev gd && docker-php-ext-install gd && docker-php-ext-install pdo pdo_mysql
RUN docker-php-ext-install pdo pdo_mysql pcntl
RUN composer install
FROM php:8.1-apache-buster
RUN docker-php-ext-install pdo pdo_mysql pcntl
RUN pecl install redis && docker-php-ext-enable redis
EXPOSE 8080
COPY --from=build /app /var/www/
COPY docker/000-default.conf /etc/apache2/sites-available/000-default.conf
COPY docker/supervisord.conf /etc/supervisord.conf
COPY .env.example /var/www/.env
RUN echo 'max_execution_time = 1200' >> /usr/local/etc/php/conf.d/docker-php-maxexectime.ini;
RUN echo 'memory_limit = 1G' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini;
RUN echo 'php artisan horizon'
RUN chmod 777 -R /var/www/storage/ && \
echo "Listen 8080" >> /etc/apache2/ports.conf && \
chown -R www-data:www-data /var/www/ && \
a2enmod rewrite
Horizon configuration file:
return [
/*
|--------------------------------------------------------------------------
| Horizon Domain
|--------------------------------------------------------------------------
|
| This is the subdomain where Horizon will be accessible from. If this
| setting is null, Horizon will reside under the same domain as the
| application. Otherwise, this value will serve as the subdomain.
|
*/
'domain' => env('HORIZON_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| Horizon Path
|--------------------------------------------------------------------------
|
| This is the URI path where Horizon will be accessible from. Feel free
| to change this path to anything you like. Note that the URI will not
| affect the paths of its internal API that aren't exposed to users.
|
*/
'path' => env('HORIZON_PATH', 'horizon'),
/*
|--------------------------------------------------------------------------
| Horizon Redis Connection
|--------------------------------------------------------------------------
|
| This is the name of the Redis connection where Horizon will store the
| meta information required for it to function. It includes the list
| of supervisors, failed jobs, job metrics, and other information.
|
*/
'use' => 'default',
/*
|--------------------------------------------------------------------------
| Horizon Redis Prefix
|--------------------------------------------------------------------------
|
| This prefix will be used when storing all Horizon data in Redis. You
| may modify the prefix when you are running multiple installations
| of Horizon on the same server so that they don't have problems.
|
*/
'prefix' => env(
'HORIZON_PREFIX',
Str::slug(env('APP_NAME', 'laravel'), '_').'_horizon:'
),
/*
|--------------------------------------------------------------------------
| Horizon Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will get attached onto each Horizon route, giving you
| the chance to add your own middleware to this list or change any of
| the existing middleware. Or, you can simply stick with this list.
|
*/
'middleware' => ['web', 'sessionvalidation'],
/*
|--------------------------------------------------------------------------
| Queue Wait Time Thresholds
|--------------------------------------------------------------------------
|
| This option allows you to configure when the LongWaitDetected event
| will be fired. Every connection / queue combination may have its
| own, unique threshold (in seconds) before this event is fired.
|
*/
'waits' => [
'redis:default' => 60,
],
/*
|--------------------------------------------------------------------------
| Job Trimming Times
|--------------------------------------------------------------------------
|
| Here you can configure for how long (in minutes) you desire Horizon to
| persist the recent and failed jobs. Typically, recent jobs are kept
| for one hour while all failed jobs are stored for an entire week.
|
*/
'trim' => [
'recent' => 60,
'pending' => 60,
'completed' => 60,
'recent_failed' => 10080,
'failed' => 10080,
'monitored' => 10080,
],
/*
|--------------------------------------------------------------------------
| Metrics
|--------------------------------------------------------------------------
|
| Here you can configure how many snapshots should be kept to display in
| the metrics graph. This will get used in combination with Horizon's
| `horizon:snapshot` schedule to define how long to retain metrics.
|
*/
'metrics' => [
'trim_snapshots' => [
'job' => 24,
'queue' => 24,
],
],
/*
|--------------------------------------------------------------------------
| Fast Termination
|--------------------------------------------------------------------------
|
| When this option is enabled, Horizon's "terminate" command will not
| wait on all of the workers to terminate unless the --wait option
| is provided. Fast termination can shorten deployment delay by
| allowing a new instance of Horizon to start while the last
| instance will continue to terminate each of its workers.
|
*/
'fast_termination' => false,
/*
|--------------------------------------------------------------------------
| Memory Limit (MB)
|--------------------------------------------------------------------------
|
| This value describes the maximum amount of memory the Horizon master
| supervisor may consume before it is terminated and restarted. For
| configuring these limits on your workers, see the next section.
|
*/
'memory_limit' => 128,
/*
|--------------------------------------------------------------------------
| Queue Worker Configuration
|--------------------------------------------------------------------------
|
| Here you may define the queue worker settings used by your application
| in all environments. These supervisors and settings handle all your
| queued jobs and will be provisioned by Horizon during deployment.
|
*/
'defaults' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['default'],
'balance' => 'auto',
'maxProcesses' => 1,
'maxTime' => 0,
'maxJobs' => 0,
'memory' => 128,
'tries' => 1,
'timeout' => 60,
'nice' => 0,
],
],
'environments' => [
'production' => [
'supervisor-1' => [
'maxProcesses' => 10,
'balanceMaxShift' => 1,
'balanceCooldown' => 3,
'queue'=> ['low', 'medium', 'high', 'vip'],
],
],
'local' => [
'supervisor-1' => [
'maxProcesses' => 3,
'queue'=> ['low', 'medium', 'high', 'vip'],
],
],
],
];
Supervisord.conf
[supervisord]
nodaemon=true
[program:laravel-worker]
process_name=%(exampleprocessname)s_%(process_num)02d
command=php /var/www/artisan horizon
autostart=true
autorestart=true
numprocs=1
redirect_stderr=true
Would anyone be able to give me some clues as to where it might go wrong?
Thank you
Ps. The environment variables are exactly the same between the .env and the horizon configuration file.
Is it possible to run background tasks in Cloud Run ? i thought it operates only on request, and therefore after a request is handled it stops working, until the next requests comes in.
The trick is to pass a custom container command in Cloud Run with the value /usr/bin/supervisord to actually start the supervisor/Horizon.
But there's another trick you need, as Cloud Run expects the service to respond to a health check request. You should not only start Horizon from supervisor (which by default would override the container command and not start Apache), but also start Apache, so the service can be considered healthy.
You can also pick a more lightweight solution, that will return HTTP 200 on request to the root of your service, as Apache feels a bit overkill for this purpose.
Disclosure: I believe I happen to be currently working for ilovecookies
I have Laravel 5.3 site.
I added some api routes today but they are not called.
Indeed I have a NewRouteController file under Http/Api
But the route returns 404 error. The controller is never reached.
There are other routes in api.php that work fine (call one of them api/workingroute, for instance). But if I comment out their route in api.php, they still work!
Here is the api.php file:
Route::group(['prefix' => 'api'], function () { Route::resource('workingroute', 'Api\WorkingRouteController'); });
Route::group(['prefix' => 'api'], function () { Route::resource('newroute', 'Api\NewRouteController'); });
I think the problem is revealed by route:list
GET|HEAD | api/api/newitems | newitems.index | App\Http\Controllers\Api\New RouteController#index | api |
| | POST | api/api/newitems | newitems.store | App\Http\Controllers\Api\New Route#store | api |
| | GET|HEAD | api/api/newitems/create | newitems.create | App\Http\Controllers\Api\New Route#create | api |
| | GET|HEAD | api/api/newitems/{newitem} | newitems.show | App\Http\Controllers\Api\New Route#show | api |
| | DELETE | api/api/newitems/{newitem} | newitems.destroy | App\Http\Controllers\Api\New Route#destroy | api |
| | PUT|PATCH | api/api/newitems/{newitem} | newitems.update | App\Http\Controllers\Api\New Route#update | api |
| | GET|HEAD | api/api/newitems/{newitem}/edit | newitems.edit | App\Http\Controllers\Api\New Route#edit | api
Not sure why we have api/api since I don't see anywhere where I would have indicated the route that way, especially since I am just repeating everything that exists for working api routes. Or I suppose since I am using api.php that the prefix is already added.
Also, odd that for my working route, I have a bunch of entries of form api/route, but they also have repeat entries of form api/api/route
And for routes of form api/api/item we have these sorts of lines
api/api/item/{item} | item.show | App\Http\Controllers\Api\ItemController#show | api
For routes of form api/item these sorts of lines:
GET|HEAD | api/item/{item} | lesson.show | App\Http\Controllers\Api\ItemController#show | web,auth,admin
I looked at routes.php which is holdover from Laravel 5.2 which is still in my folder structure, and we have these sorts of lines:
// Api
Route::group(['middleware' => ['api', 'auth', 'admin']], function () {
Route::group(array('prefix' => 'api'), function() {
RegisterResourceRoute('item', 'Item');
I think maybe I broke something when I upgraded from 5.2 to 5.3. Strangely enough, the routes defined by this routes.php are the ones of form api/item, and they work. The question now is what to do to get routes back to normal, so that all api routes are of form api/item and all have web,auth,admin?
ALso, for what it is worth (not sure if cacheing somehow influences my issue), there is .gitignore in the bootstrap/cache folder as well as all storage folders.
And here is cache.php:
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache'),
],
'memcached' => [
'driver' => 'memcached',
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => 'laravel',
];
Ideas?
Thanks,
Brian
I suspect several things have happened, but in short check your bootstrap/cache folder. In it I hope you will find a file called routes.php and it has probably been committed into your repo and now you've pulled it down or maybe you even accidentally created it yourself when playing with artisan commands.
Canonically you would use php artisan route:clear but if your command line isn't working that won't work, however you should be ok to delete it.
If this is the case, it was created with php artisan route:cache but it is advisable only to use that on your production server (possibly as part of a deploymnet script or perhaps as a git hook.)
Ideally there would be a .gitignore (if you're using git) file in the cache folder to avoid this sort of thing being transmitted between different developers.
(Edit - this is only true for later versions of Laravel, but not 5.3 - the OP's version. I leave this here in case other people have the same problem.) It is also possible that someone (if you're working in a team) has done all this on purpose and just not communicated the changes. If so it's also possible that they have specifically set another path for route caching using the environment variable 'APP_ROUTES_CACHE' in which case you'll have to look there.
Sorry this is so complicated - but because of the flexibilty of laravel there are many different ways this could be happening. Please do try them all, though - this is almost certainly a caching issue.
How to set default lang if lang doesn't exist . It should redirect to default lang I use mcamara/laravel-localization package
I want to set en = default lang and if I type url isn't exist I want to redirect into en
example
1 www.test.com/en/new
2 www.test.com/cn/new <- this url empty it should redirect into url 1
Laravel comes with en as default and you can specify the fallback in config/app.php
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
I have a problem with the session in Laravel 5.3.
For our project, we have 2 sub-domain :
1 for developement's environment
1 for preproduction's environment
for the first sub-domain no problem, it all works. But the second sub-domain nothing works. I concluded that the problem is the session, because on my second sub-domain, none cookies created.
I have look my session's file in my config and update any datas. This is my config session's file :
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 3600,
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => null,
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => null,
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => 'name_cookie', // identique for all sub-domain but i have try to change the name for each domaine
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
];
I don't found a solution despite much search,
Thanks
I found the solution, my problem came from a bad configuration of the cloud front and not of laravel. Thanks at all for your help
Did you try this ? SESSION_DOMAIN=*.mydomain.com so cookies produced in dev env would ba accessible for preprod env
EDIT : SESSION_DOMAIN=.mydomain.com was the right answer, my bad
Test it out
'domain' => '*.domain.com'
You have to specify a wildcard domain for the SESSION_DOMAIN environnement variable
Edit: too late, stackexchange didnt show up the answers