drduinfu915094 2016-05-01 14:56
浏览 43
已采纳

Laravel子域丢失重定向会话

I use subdomain wildcards to create user specific pages for example {slug}.mysite.com

Users might navigate from mysite.com to {slug}.mysite.com

However I seem to have different login sessions for these two routes / domains.

Route::group(['domain' => '{slug}.mysite.com'], function()
{
    Route::get('/', 'PagesController@showByUsername');

    Route::get('/plans/{plan}', 'PlansController@showslug');

    Route::controllers([
        'auth' => 'Auth\AuthControllerClient'
    ]);
});
  • 写回答

1条回答 默认 最新

  • dr5648 2016-05-01 14:58
    关注

    This is because cookies are specific to subdomain.

    This is from config/session.php

    /*
    |--------------------------------------------------------------------------
    | 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' => null,
    

    You will need to set this value to something which will include all of your subdomains.

    https://serverfault.com/questions/153409/can-subdomain-example-com-set-a-cookie-that-can-be-read-by-example-com

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥40 单片机实验录制讲解视频
  • ¥15 srs-sip外部服务 webrtc支持H265格式
  • ¥15 在使用abaqus软件中,继承到assembly里的surfaces怎么使用python批量调动
  • ¥15 大一C语言期末考试,求帮助🙏🙏
  • ¥15 ch340驱动未分配COM
  • ¥15 Converting circular structure to JSON
  • ¥15 Onvif Device Manager提示“对操作"GetProfiles”的回复消息正文进行反序列化时出错”问题
  • ¥30 Hyper-v虚拟机相关问题,求解答。
  • ¥15 TSM320F2808PZA芯片 Bootloader
  • ¥45 谷歌浏览器出现开发者工具无法显示已创建的,但您可以调试已部署的代码。 状态代码 404, net::ERR HTTP RESPONSE CODE FAILURE