Symfony 3在子域之间共享cookie? [英] Symfony 3 sharing cookies across sub-domains?

查看:93
本文介绍了Symfony 3在子域之间共享cookie?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在任何子域之间共享一个cookie。然后,这应该允许我保留会话。我正在使用Symfony框架版本3.0。

I want to share a cookie across any subdomain. This should then allow me to keep the session. I am using the Symfony framework version 3.0.

我读到您应该设置以下内容:

I've read that you should set the following:

## app/config/config.yml
   session:
       cookie_domain: .localhost

我对此尝试了多种变体,但没有一个改变任何东西。与Cookie关联的域
不会更改。任何想法这应该怎么做?我缺少什么。

I tried multiple variations on this but none of them change anything. the domain associated with the cookie won't change. Any ideas how this should be done?? What am I missing.

推荐答案

请确保您需要删除cookie并重新登录。

To be sure you need to delete your cookie and log back.

session:
    cookie_lifetime: 0
    save_path: %kernel.root_dir%/var/sessions
    cookie_domain: .my-domain.com
    name: SFSESSID

这篇关于Symfony 3在子域之间共享cookie?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆