Forums / General Questions / Add period prefix to cookie domain?

Add period prefix to cookie domain?

Views: 3,682

Results 1 to 9 of 9
19 May 2011, 7:05 PM
#1
blessisaacola avatar

blessisaacola

Totally Zenned

Join Date:
Feb 2004
Location:
Georgia, USA
Posts:
1,875
Plugin Contributions:
1

Add period prefix to cookie domain?

Can some please explain to me what the difference is between setting this option in Admin - Configuration - Sessions to True or False:

Add period prefix to cookie domain

The default value is true but I am wonder what the danger is in setting it to False. We are on a dedicated server and only host our https://www.clevershoppers.com on the server and I am wondering if I can safely change this setting to False.

Thanks!

19 May 2011, 7:09 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Add period prefix to cookie domain?

Why are you wanting to change it?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 May 2011, 12:28 AM
#3
blessisaacola avatar

blessisaacola

Totally Zenned

Join Date:
Feb 2004
Location:
Georgia, USA
Posts:
1,875
Plugin Contributions:
1

Re: Add period prefix to cookie domain?

DrByte:

Why are you wanting to change it?

To be honest it looks sort of crazy starring at .https://www.clevershoppers.com and when I look at some of the other ecommerce's cookie all of them did not have the . (period) in the cookie set on my computer.

I am assuming it's there for people using subdomain but the perhaps that's not it. I am just not sure if it's needed for our situation. It would be nice to know what some of these functionality are there for.

Another reason that prompted me in looking into is when some of our customers starting having cookie issue.

20 May 2011, 2:59 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Add period prefix to cookie domain?

It's there to deal with cases where the prefix is needed. There are numerous possible reasons for one way or the other, dictated by both the server platform you're running on as well as the browser used by the majority of your customers.

And the fact that MS doesn't follow the rules doesn't help either.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 May 2011, 6:43 AM
#5
blessisaacola avatar

blessisaacola

Totally Zenned

Join Date:
Feb 2004
Location:
Georgia, USA
Posts:
1,875
Plugin Contributions:
1

Re: Add period prefix to cookie domain?

DrByte:

It's there to deal with cases where the prefix is needed. There are numerous possible reasons for one way or the other, dictated by both the server platform you're running on as well as the browser used by the majority of your customers.

And the fact that MS doesn't follow the rules doesn't help either.

So in our particular case (not necessarily what works for most people) is there any danger in setting it to False so it doesn't add the period. Again my thinking might be faulty...but I am thinking https://www.clevershoppers.com is going to create less issue than .https://www.clevershoppers.com

Again, I really didn't even know this existed until a few customers emailed about session/cookie issue. I search the forum and one of the post suggested setting this to false solved similar issues.

To be honest, I am clueless what this setting/function actually does so I not writing as someone that is knowledgeable about this just looking for clarification/direction.

Thanks!

20 May 2011, 7:15 AM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Add period prefix to cookie domain?

If you set it incorrectly, nobody will be able to shop. Generally you'll know right away (after clearing your browser cache and cookies and restarting the browser) by doing a test yourself.

The setting was added very recently, specifically to deal with occasional cases where session problems existed.

I've asked wilt to respond in more detail for you ...

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 May 2011, 7:21 AM
#7
blessisaacola avatar

blessisaacola

Totally Zenned

Join Date:
Feb 2004
Location:
Georgia, USA
Posts:
1,875
Plugin Contributions:
1

Re: Add period prefix to cookie domain?

DrByte:

If you set it incorrectly, nobody will be able to shop. Generally you'll know right away (after clearing your browser cache and cookies and restarting the browser) by doing a test yourself.

The setting was added very recently, specifically to deal with occasional cases where session problems existed.

I've asked wilt to respond in more detail for you ...

Thanks Dr. Byte for the prompt response. It works whether the setting is False or True and I tried in IE, FF, Chrome and Safari. Obviously, there's a reason why the default value is set to True so I will wait for more clarification from Wilt to see if there's an argument one way or the other with the setting.

Thanks agian for your help.

24 May 2011, 4:23 PM
#8
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,927
Plugin Contributions:
3

Re: Add period prefix to cookie domain?

Hi,

If you really want to delve into the history and technicalities of cookies then pls
see

http://www.ietf.org/rfc/rfc2965.txt

http://www.ietf.org/rfc/rfc2109.txt

There are a couple of reasons why the setting was added.

If a cookie is set with out a leading period the cookie is only valid for that domain, and not for any subdomains.

So if my cookie domain is zen-cart.com then the cookie is not valid for https://www.zen-cart.com. This is obviously important given that a lot of sites these days eschew the use of the www prefix.

It's also complicated by the fact that different browsers report the host differently, eg some will add the leading . others won't (although this was mainly Microsoft browsers, and they are a lot better these days) and by the way different servers (apache vs IIS) report the domain to the browser.

and even further complicated by how shared SSL hosts might report the domain. eg where the ssl domain is something like https://somedomain.sharedssl.com

24 May 2011, 11:52 PM
#9
blessisaacola avatar

blessisaacola

Totally Zenned

Join Date:
Feb 2004
Location:
Georgia, USA
Posts:
1,875
Plugin Contributions:
1

Re: Add period prefix to cookie domain?

wilt:

Hi,

If you really want to delve into the history and technicalities of cookies then pls
see

http://www.ietf.org/rfc/rfc2965.txt

http://www.ietf.org/rfc/rfc2109.txt

There are a couple of reasons why the setting was added.

If a cookie is set with out a leading period the cookie is only valid for that domain, and not for any subdomains.

So if my cookie domain is zen-cart.com then the cookie is not valid for https://www.zen-cart.com. This is obviously important given that a lot of sites these days eschew the use of the www prefix.

It's also complicated by the fact that different browsers report the host differently, eg some will add the leading . others won't (although this was mainly Microsoft browsers, and they are a lot better these days) and by the way different servers (apache vs IIS) report the domain to the browser.

and even further complicated by how shared SSL hosts might report the domain. eg where the ssl domain is something like https://somedomain.sharedssl.com

Thanks Wilt for the clarification and the links to read more (my head hurts now) :)

I know each situation is unique, in our site's case we use https://www.clevershoppers.com and actually have a redirect that makes sure anything that doesn't point to https://www.clevershoppers.com gets redirected to the www version. So if someone types clevershoppers.com it goes to the www version. It seems odd then in that situation to have the cookie with a period in front of the www.

Again, the logic makes sense from what you've described. I have dropped the leading period from ours and so far so good, it's not affecting site accessibility. At least not that I am aware of so hopefully, I didn't break anything by setting it to false.

Thanks!