Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I got several Laravel 5 projects running on subfolders, on the same domain.

Each Laravel application is generating it's own session cookie, and sometimes it generates so much that we get http 400 errors on the entire domain.

Should I share the storage folder between all those projects, or there's any settings to prevent that to happen?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
547 views
Welcome To Ask or Share your Answers For Others

1 Answer

Each Laravel installation should be located in its own directory.

Then an alias needs to be defined which points the domain sub-folder to the "child" Laravel folder.

Example in Apache http.conf:

<VirtualHost some.domain:80>

    ServerName some.domain

    ## Path to laravel domain
    DocumentRoot "/path/to/some/domain/laravel-1/public"
    <Directory "/path/to/some/domain/laravel-1/public">
        AllowOverride All
    </Directory>

    ## Path to laravel sub-folder
    Alias /laravel-2-path-alias/ "/path/to/some/domain/laravel-2/public"
    <Directory "/path/to/some/domain/laravel-2/public">
        AllowOverride All
    </Directory>

</VirtualHost>

For session cookies, check configsession.php in both installations.

Root installation configsession.php:

'cookie' => 'a_unique_name'
'path' => '/',

Subfolder installation configsession.php:

'cookie' => 'another_unique_name'
'path' => '/path/to/sub/folder',

This should ensure that each installation is writing its own unique session cookies. Any cookies generated by the sub application should not interfere with those of the parent.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...