Re: Experiencing issues

From: Khushboo Vashi <khushboo(dot)vashi(at)enterprisedb(dot)com>
To: Joao De Almeida Pereira <jdealmeidapereira(at)pivotal(dot)io>
Cc: Dave Page <dpage(at)pgadmin(dot)org>, Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Experiencing issues
Date: 2018-03-22 02:57:03
Message-ID: CAFOhELcX9LjZrvyp6oP7LkVgiL+FH_SchyAYO5CKouA6KzxgrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Wed, Mar 21, 2018 at 10:00 PM, Joao De Almeida Pereira <
jdealmeidapereira(at)pivotal(dot)io> wrote:

> Another thing when I do this configuration:
>
> DEFAULT_SERVER = '127.0.0.1'
> SESSION_COOKIE_DOMAIN = 'localhost'
> COOKIE_DEFAULT_DOMAIN = 'localhost'
>
> I get the following exception:
> builtins.ValueError
>
> ValueError: Setting 'domain' for a cookie on a server running localy (ex:
> localhost) is not supportted by complying browsers. You should have
> something like: '127.0.0.1 localhost dev.localhost' on your hosts file and
> then point your server to run on 'dev.localhost' and also set 'domain' for
> 'dev.localhost'
> And if you follow the instructions and change the hosts file it allows you
> to start the application but when you try to open a database server you
> will get the 428 error
> Thanks
> Joao
>
> Right, many browser doesn't support localhost as a cookie domain.
The settings you did is not correct, your cookie will be stored as a
'localhost' domain and you trying to run the app as 127.0.0.1.
If we set a domain for the cookie than either that domain or sub-domains
can access that cookie.

In regards to your question of 2 domain names, this type of situation
arrives when any site is configured explicitly to divide the load. In case
of pgAdmin 4, this is not going to happen :).
It is always recommend to use cookie with domain settings, but as Dave
suggested we can leave that upto user. So, we will make it configurable and
user will decide to have it or not.

>
> On Wed, Mar 21, 2018 at 12:01 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>> On Wed, Mar 21, 2018 at 3:57 PM, Joao De Almeida Pereira <
>> jdealmeidapereira(at)pivotal(dot)io> wrote:
>>
>>> Sorry I did not understand what you said.
>>> This configuration:
>>>
>>> DEFAULT_SERVER = '0.0.0.0'
>>> SESSION_COOKIE_DOMAIN = DEFAULT_SERVER
>>> COOKIE_DEFAULT_DOMAIN = DEFAULT_SERVER
>>>
>>> If the application lives in the domain pgadmin.somedomain.com do I need
>>> to have in config_local:
>>> DEFAULT_SERVER = '0.0.0.0'
>>> SESSION_COOKIE_DOMAIN = 'pgadmin.somedomain.com'
>>> COOKIE_DEFAULT_DOMAIN = 'pgadmin.somedomain.com'
>>> ?
>>>
>>> Does this mean that if for some reason I have a second domain like
>>> pgadmin.somedomain2.com that I want to use I cannot?
>>>
>>> The issue of 127.0.0.1 to localhost is very cumbersome, and somehow we
>>> should be able to disable this, because when we are developing doesn't make
>>> sense to not being able to use localhost and 127.0.0.1
>>>
>>
>> +1. I didn't realise we'd added this restriction when I tested the patch.
>>
>> Perhaps a better approach would be to leave the default cookie handling
>> as it was, and just expose the domain and path via config options that the
>> user can set if appropriate for their installation.
>>
>>
>>
>>>
>>> Thanks
>>> Joao
>>>
>>> On Wed, Mar 21, 2018 at 11:01 AM Khushboo Vashi <
>>> khushboo(dot)vashi(at)enterprisedb(dot)com> wrote:
>>>
>>>> On Wed, Mar 21, 2018 at 8:27 PM, Joao De Almeida Pereira <
>>>> jdealmeidapereira(at)pivotal(dot)io> wrote:
>>>>
>>>>> So what you are saying is that if I have a server, I need to do
>>>>> DEFAULT_SERVER=0.0.0.0 and then set the real domain on the COOKIE domain?
>>>>>
>>>>> No I am saying, whatever you set as a DEFAULT_SERVER, the app can be
>>>> accessible with that server.
>>>> As, we have explicitly set DOMAIN in the cookie setting.
>>>>
>>>>> On Wed, Mar 21, 2018 at 10:55 AM Khushboo Vashi <
>>>>> khushboo(dot)vashi(at)enterprisedb(dot)com> wrote:
>>>>>
>>>>>> On Wed, Mar 21, 2018 at 8:10 PM, Joao De Almeida Pereira <
>>>>>> jdealmeidapereira(at)pivotal(dot)io> wrote:
>>>>>>
>>>>>>> Ok Murtuza you are right,
>>>>>>> Now my question is I have the default server to 127.0.0.1 and I want
>>>>>>> to access it using localhost as well. How can I do this?
>>>>>>>
>>>>>>> No, you can't.
>>>>>> Domain based cookie will work for that domain and it's sub-domains.
>>>>>>
>>>>>>> On Wed, Mar 21, 2018 at 10:39 AM Khushboo Vashi <
>>>>>>> khushboo(dot)vashi(at)enterprisedb(dot)com> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 21 Mar 2018 20:01, "Joao De Almeida Pereira" <
>>>>>>>> jdealmeidapereira(at)pivotal(dot)io> wrote:
>>>>>>>>
>>>>>>>> I tried that but still nothing. When i check in the inspector for
>>>>>>>> cookies I have none
>>>>>>>>
>>>>>>>> Share your config_local file.
>>>>>>>>
>>>>>>>> On Wed, Mar 21, 2018 at 10:30 AM Murtuza Zabuawala <
>>>>>>>> murtuza(dot)zabuawala(at)enterprisedb(dot)com> wrote:
>>>>>>>>
>>>>>>>>> Yes, that's cookie related issue (RM#3197), To fix that I added
>>>>>>>>> below in my config_local.py and it started working again,
>>>>>>>>>
>>>>>>>>> DEFAULT_SERVER = '0.0.0.0'
>>>>>>>>> COOKIE_DEFAULT_DOMAIN = SESSION_COOKIE_DOMAIN = DEFAULT_SERVER
>>>>>>>>>
>>>>>>>>> Clear your browser cookies and server side sessions.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards,
>>>>>>>>> Murtuza Zabuawala
>>>>>>>>> EnterpriseDB: http://www.enterprisedb.com
>>>>>>>>> The Enterprise PostgreSQL Company
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Mar 21, 2018 at 7:55 PM, Joao De Almeida Pereira <
>>>>>>>>> jdealmeidapereira(at)pivotal(dot)io> wrote:
>>>>>>>>>
>>>>>>>>>> Where can I find information about that?
>>>>>>>>>>
>>>>>>>>>> On Wed, Mar 21, 2018 at 10:16 AM Khushboo Vashi <
>>>>>>>>>> khushboo(dot)vashi(at)enterprisedb(dot)com> wrote:
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 21 Mar 2018 19:41, "Joao De Almeida Pereira" <
>>>>>>>>>>> jdealmeidapereira(at)pivotal(dot)io> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Hello Hackers,
>>>>>>>>>>> Can anyone use the current master branch?
>>>>>>>>>>> When I try to open a server I get a 428. Is that only me?
>>>>>>>>>>>
>>>>>>>>>>> May be because of cookie changes.
>>>>>>>>>>> Check your config.py and config_local.py if you have done
>>>>>>>>>>> changes related to DEFAULT_SERVER in your config_local.py then you need to
>>>>>>>>>>> change other 2 cookie related variables also.
>>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>> Joao
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>

In response to

Browse pgadmin-hackers by date

  From Date Subject
Next Message Akshay Joshi 2018-03-22 03:32:48 Re: v3.0 release on hold
Previous Message Rahul Soshte 2018-03-21 20:14:22 Re: Connection Refused Error