librelist archives

« back to archive

Session cookie and subdomain

Session cookie and subdomain

From:
Thomas Beugin
Date:
2010-11-28 @ 22:45
Hello flaskusers :)

There is a way for use the flask session across subdomain????

I test on myurl.com >> loged ok
I test on www.myurl.com >> not loged

Thanks a lot :)

Best regards,
Beugin Thomas

Re: [flask] Session cookie and subdomain

From:
Armin Ronacher
Date:
2010-11-28 @ 23:13
Hi,

On 11/28/10 11:45 PM, Thomas Beugin wrote:
> There is a way for use the flask session across subdomain????
Yes.  You need to set SERVER_NAME:
   http://flask.pocoo.org/docs/config/#builtin-configuration-values

Not sure if SERVER_NAME was used for the sessions with 0.6, but it 
should be in the latest development version.


Regards,
Armin

Re: [flask] Session cookie and subdomain

From:
Thomas Beugin
Date:
2010-11-28 @ 23:22
I have the 0.6 version

I try without server_name

With server_name : www.myurl.com
I can acces to my site on www.myurl.com but not to myurl.com


With server_name : myurl.com
I can acces to my site on myurl.com but not to www.myurl.com

With server_name : .myurl.com
I can't acces to my site on myurl.com and www.myurl.com



Cordialement,
Beugin Thomas



2010/11/29 Armin Ronacher <armin.ronacher@active-4.com>:
> Hi,
>
> On 11/28/10 11:45 PM, Thomas Beugin wrote:
>> There is a way for use the flask session across subdomain????
> Yes.  You need to set SERVER_NAME:
>   http://flask.pocoo.org/docs/config/#builtin-configuration-values
>
> Not sure if SERVER_NAME was used for the sessions with 0.6, but it
> should be in the latest development version.
>
>
> Regards,
> Armin
>

Re: [flask] Session cookie and subdomain

From:
Thomas Beugin
Date:
2010-11-28 @ 23:28
With server_name : www.myurl.com
I can acces to my site on www.myurl.com but not to myurl.com


With server_name : myurl.com
I can acces to my site on myurl.com but not to www.myurl.com

For these tests

there is no error en debug, only a 404 in apache access.log




Cordialement,
Beugin Thomas



2010/11/29 Thomas Beugin <kimkof@gmail.com>:
> I have the 0.6 version
>
> I try without server_name
>
> With server_name : www.myurl.com
> I can acces to my site on www.myurl.com but not to myurl.com
>
>
> With server_name : myurl.com
> I can acces to my site on myurl.com but not to www.myurl.com
>
> With server_name : .myurl.com
> I can't acces to my site on myurl.com and www.myurl.com
>
>
>
> Cordialement,
> Beugin Thomas
>
>
>
> 2010/11/29 Armin Ronacher <armin.ronacher@active-4.com>:
>> Hi,
>>
>> On 11/28/10 11:45 PM, Thomas Beugin wrote:
>>> There is a way for use the flask session across subdomain????
>> Yes.  You need to set SERVER_NAME:
>>   http://flask.pocoo.org/docs/config/#builtin-configuration-values
>>
>> Not sure if SERVER_NAME was used for the sessions with 0.6, but it
>> should be in the latest development version.
>>
>>
>> Regards,
>> Armin
>>
>

Re: [flask] Session cookie and subdomain

From:
Thomas Beugin
Date:
2010-11-28 @ 23:38
Ok :)

I remove SERVER_NAME of my config and do some change on app.py

Its not clean but its work for now..


 def save_session(self, session, response):
        """Saves the session if it needs updates.  For the default
        implementation, check :meth:`open_session`.

        :param session: the session to be saved (a
                        :class:`~werkzeug.contrib.securecookie.SecureCookie`
                        object)
        :param response: an instance of :attr:`response_class`
        """
        expires = domain = None
        if session.permanent:
            expires = datetime.utcnow() + self.permanent_session_lifetime
    ---->>>    domain='.mydomain.tld'
        session.save_cookie(response, self.session_cookie_name,
                            expires=expires, httponly=True, domain=domain)

Cordialement,
Beugin Thomas



2010/11/29 Thomas Beugin <kimkof@gmail.com>:
> With server_name : www.myurl.com
> I can acces to my site on www.myurl.com but not to myurl.com
>
>
> With server_name : myurl.com
> I can acces to my site on myurl.com but not to www.myurl.com
>
> For these tests
>
> there is no error en debug, only a 404 in apache access.log
>
>
>
>
> Cordialement,
> Beugin Thomas
>
>
>
> 2010/11/29 Thomas Beugin <kimkof@gmail.com>:
>> I have the 0.6 version
>>
>> I try without server_name
>>
>> With server_name : www.myurl.com
>> I can acces to my site on www.myurl.com but not to myurl.com
>>
>>
>> With server_name : myurl.com
>> I can acces to my site on myurl.com but not to www.myurl.com
>>
>> With server_name : .myurl.com
>> I can't acces to my site on myurl.com and www.myurl.com
>>
>>
>>
>> Cordialement,
>> Beugin Thomas
>>
>>
>>
>> 2010/11/29 Armin Ronacher <armin.ronacher@active-4.com>:
>>> Hi,
>>>
>>> On 11/28/10 11:45 PM, Thomas Beugin wrote:
>>>> There is a way for use the flask session across subdomain????
>>> Yes.  You need to set SERVER_NAME:
>>>   http://flask.pocoo.org/docs/config/#builtin-configuration-values
>>>
>>> Not sure if SERVER_NAME was used for the sessions with 0.6, but it
>>> should be in the latest development version.
>>>
>>>
>>> Regards,
>>> Armin
>>>
>>
>