Issue 56211 in chromium: chrome.cookies fails for localhost domains

5,376 views
Skip to first unread message

chro...@googlecode.com

unread,
Sep 19, 2010, 5:05:23 PM9/19/10
to chromi...@chromium.org
Status: Unconfirmed
Owner: ----
Labels: Type-Bug Pri-2 Area-Undefined

New issue 56211 by dawagner: chrome.cookies fails for localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Call chrome.cookies.set({domain: "localhost", name: "foo", value: "bar",
url: "http://localhost/"});

Expect: Cookie to be set

Get: Error during cookies.set: Failed to parse or set cookie named "foo".

chro...@googlecode.com

unread,
Sep 19, 2010, 6:52:24 PM9/19/10
to chromi...@chromium.org
Issue 56211: chrome.cookies fails for localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

This issue is now blocking issue selenium:818.
See http://code.google.com/p/selenium/issues/detail?id=818

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

chro...@googlecode.com

unread,
Sep 20, 2010, 5:15:58 AM9/20/10
to chromi...@chromium.org
Updates:
Status: Invalid
Labels: -Area-Undefined Area-Internals

Comment #1 on issue 56211 by joc...@chromium.org: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

You can only set domain cookies for registry controlled domains, i.e.
something ending in .com or so, but not IPs or intranet hostnames like
localhost

chro...@googlecode.com

unread,
Oct 27, 2011, 2:59:40 PM10/27/11
to chromi...@chromium.org

Comment #3 on issue 56211 by mr.shy...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

I am in the same boat. I love chrome, but my work needs me to work on
localhost... so I have to use Firefox, and I lose all my favorite features
and interfaces.

chro...@googlecode.com

unread,
Jan 15, 2012, 3:56:34 AM1/15/12
to chromi...@chromium.org

Comment #6 on issue 56211 by ThomasMo...@gmail.com: chrome.cookies fails

please answer to comment #5

chro...@googlecode.com

unread,
Apr 12, 2012, 7:43:40 AM4/12/12
to chromi...@chromium.org

Comment #9 on issue 56211 by matsem...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Bump

Answer comment #5.
As for now, Chrome users will get a notification using our systems, and are
asked to install a proper browser that don't fiddle with stuff like this.

chro...@googlecode.com

unread,
May 25, 2012, 9:07:45 AM5/25/12
to chromi...@chromium.org

Comment #10 on issue 56211 by gele...@gmail.com: chrome.cookies fails for
Please answer comment #5.

Actually we do not use chrome any more in our company because our intranet
sites is not available

chro...@googlecode.com

unread,
Jun 8, 2012, 9:09:58 AM6/8/12
to chromi...@chromium.org

Comment #11 on issue 56211 by ak.sa...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Please answer comment #5.


chro...@googlecode.com

unread,
Jun 8, 2012, 10:04:44 AM6/8/12
to chromi...@chromium.org

Comment #12 on issue 56211 by ak.sa...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

I've have faced a problem in chrome and IE9,
working on localhost, when I use the function setcookie() in PHP and give
it all the parameters, the cookie won't be stored!! which is not the case
for FF and Opera!!,
but when I try it just with the cookie name, the value, and the expiry date
parameters all goes right and the cookie is stored...and now here are the
two PHP codes that I have used:

Function with all the parameters:
setcookie( 'reloginID', $digest, time()+60*60*24*7, '/', 'localhost',
false, true); /*=== Works normaly in FF and Opera ===*/

Function with less parameters:
setcookie( 'reloginID', $digest, time()+60*60*24*7);

So can any one explain that ...
Thank you in advance ;)

chro...@googlecode.com

unread,
Jun 8, 2012, 10:21:36 AM6/8/12
to chromi...@chromium.org

Comment #13 on issue 56211 by ak.sa...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

I've have faced a problem in chrome and IE9,
working on localhost, when I use the function setcookie() in PHP and give
it all the parameters, the cookie won't be stored!! which is not the case
for FF and Opera!!,
but when I try it just with the cookie name, the value, and the expiry date
parameters all goes right and the cookie is stored...and now here are the
two PHP codes that I have used:

Function with all of the parameters:

chro...@googlecode.com

unread,
Jun 8, 2012, 10:29:38 AM6/8/12
to chromi...@chromium.org

Comment #14 on issue 56211 by david.k...@gmail.com: chrome.cookies fails
The problem in your code is the parameter "localhost". This is the topic of
this discussion: Chromium has introduced a limit that prevents cookies to
work when the parameter "domain" is used with the value "localhost". It
surprised everyone and they do not explain very clearly why they introduced
this limitation ...

chro...@googlecode.com

unread,
Jun 8, 2012, 10:54:42 AM6/8/12
to chromi...@chromium.org

Comment #15 on issue 56211 by ak.sa...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Thanks for clarifying.

chro...@googlecode.com

unread,
Jul 11, 2012, 2:50:36 PM7/11/12
to chromi...@chromium.org

Comment #16 on issue 56211 by mdrit...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Very surprised by this! What is the reasoning?

chro...@googlecode.com

unread,
Jul 18, 2012, 12:52:14 PM7/18/12
to chromi...@chromium.org

chro...@googlecode.com

unread,
Jul 18, 2012, 1:22:15 PM7/18/12
to chromi...@chromium.org

Comment #18 on issue 56211 by will...@chromium.org: chrome.cookies fails
Issue 137827 has been merged into this issue.

chro...@googlecode.com

unread,
Aug 10, 2012, 6:35:17 AM8/10/12
to chromi...@chromium.org

Comment #19 on issue 56211 by adam.nin...@gmail.com: chrome.cookies fails
Bump. Still a problem nearly 2 years later. Please address, or at the
very least try to defend your incorrect position so we can fault your
reasoning and get a developer to accept that the issue needs fixing.

chro...@googlecode.com

unread,
Aug 19, 2012, 6:16:45 PM8/19/12
to chromi...@chromium.org

Comment #21 on issue 56211 by okinro...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

I have no idea?

chro...@googlecode.com

unread,
Aug 27, 2012, 9:21:25 AM8/27/12
to chromi...@chromium.org

Comment #22 on issue 56211 by martin.s...@gmail.com: chrome.cookies fails
While being different and innovative is nice, this "feature", even if its
not part of the specs, is used by so many people, especially developers, me
included.

Please answer comment #5 and introduce a way to enable Cookies on
localhost, even though a hack with the hosts file can fix it.

chro...@googlecode.com

unread,
Sep 28, 2012, 4:59:42 AM9/28/12
to chromi...@chromium.org

Comment #23 on issue 56211 by mohamada...@gmail.com: chrome.cookies fails
good

chro...@googlecode.com

unread,
Nov 11, 2012, 4:37:20 PM11/11/12
to chromi...@chromium.org

Comment #24 on issue 56211 by Alkasier...@gmail.com: chrome.cookies fails
f

chro...@googlecode.com

unread,
Nov 12, 2012, 5:53:04 AM11/12/12
to chromi...@chromium.org

Comment #25 on issue 56211 by a.w.2ndc...@gmail.com: chrome.cookies fails
.........


chro...@googlecode.com

unread,
Nov 21, 2012, 2:21:44 AM11/21/12
to chromi...@chromium.org

Comment #26 on issue 56211 by royestel...@gmail.com: chrome.cookies fails
Please answer comment #5

chro...@googlecode.com

unread,
Nov 26, 2012, 11:43:39 AM11/26/12
to chromi...@chromium.org

Comment #27 on issue 56211 by digistr...@gmail.com: chrome.cookies fails
Dear Google just what are you doing? I really don't need to mention this
but I will. As a web developer from the very early days before even web
developers ever really existed, some 18 years ago nearly. I find it
impossible to understand your logic at not including the facility to accept
cookies from a localhost server. I would expect many thousands of
developers are scratching their heads at this, even now.

I only recently decided to start using Chrome as well as other browsers to
make sure the sites that I design and code are as near to the original
design as possible. Every browser has its quirks and I like many thousands
of others would expect and require this facility within a web browser. So
why?


chro...@googlecode.com

unread,
Dec 1, 2012, 4:50:13 PM12/1/12
to chromi...@chromium.org

Comment #28 on issue 56211 by stephani...@gmail.com: chrome.cookies fails
(No comment was entered for this change.)

Attachments:
ACME Expense Report.xlsx 16.9 KB

chro...@googlecode.com

unread,
Dec 3, 2012, 3:13:18 AM12/3/12
to chromi...@chromium.org

Comment #29 on issue 56211 by zt.t...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

For those who have encountered this issue with localhost or other
non-registered domains, removing the domain= part from the cookie will
allow the cookie to be set for the requesting domain, but not any
subdomains. In PHP, use NULL for domain.

chro...@googlecode.com

unread,
Dec 5, 2012, 2:59:05 PM12/5/12
to chromi...@chromium.org

Comment #30 on issue 56211 by shmi...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Workaround for developers using /etc/hosts: it looks weird, but just add
a .com to whatever name you were using for 127.0.0.1. localhost.com,
myapp.com, etc. work fine in /etc/hosts and that way Chrome will accept the
cookies.

chro...@googlecode.com

unread,
Dec 21, 2012, 9:22:10 PM12/21/12
to chromi...@chromium.org

chro...@googlecode.com

unread,
Dec 21, 2012, 9:23:10 PM12/21/12
to chromi...@chromium.org

chro...@googlecode.com

unread,
Jan 26, 2013, 3:20:36 PM1/26/13
to chromi...@chromium.org

Comment #33 on issue 56211 by NOVACRAZ...@gmail.com: chrome.cookies fails
HOW DO I FIX THE SHOCK WAVE FLASH FROM SAYING ISN'T RESPONDING OR HAS
CRASHED ANY HELP U CAN PROVIDE ME WITH WILL BE GREATLY THANKFUL. YOURS
TRULY JEFF GOODSTEIN .


chro...@googlecode.com

unread,
Feb 16, 2013, 10:34:44 PM2/16/13
to chromi...@chromium.org

Comment #34 on issue 56211 by Brewmast...@gmail.com: chrome.cookies fails
Still bumping question #5 (why are localhost or local IP cookies invalid?).
To those getting notifications, sorry.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

chro...@googlecode.com

unread,
Mar 12, 2013, 12:55:19 AM3/12/13
to chromi...@chromium.org

Comment #36 on issue 56211 by allpra...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

I can't believe this STILL has not been fixed. The safest way to develop,
is to develop locally, try to do nastiness locally, and after it is
hardened then publish. I can't do that with your browser because of this
dumb bug ...

chro...@googlecode.com

unread,
Mar 28, 2013, 6:57:52 AM3/28/13
to chromi...@chromium.org

Comment #37 on issue 56211 by bad.stup...@gmail.com: chrome.cookies fails
Everything has been said. As web developers most of us create/test a site
on localhost before uploading..

chro...@googlecode.com

unread,
Mar 28, 2013, 8:26:10 AM3/28/13
to chromi...@chromium.org

Comment #38 on issue 56211 by chris.sh...@gmail.com: chrome.cookies fails
I have been having to use Firefox to develop locally. This is annoying as
it does not have my favorite developer toolset.

Please add support or give us a work around.

chro...@googlecode.com

unread,
Apr 18, 2013, 1:41:12 AM4/18/13
to chromi...@chromium.org

Comment #39 on issue 56211 by nazmi.sa...@gmail.com: chrome.cookies fails
I use IE for development. Its really frustrating.

chro...@googlecode.com

unread,
Apr 28, 2013, 4:47:26 PM4/28/13
to chromi...@chromium.org

Comment #40 on issue 56211 by jason.ma...@gmail.com: chrome.cookies fails
I just spent hours trying to figure out why my cookies weren't being
accepted from a "localhost" ajax response. It would really be nice to have
this feature.

chro...@googlecode.com

unread,
May 7, 2013, 10:35:30 PM5/7/13
to chromi...@chromium.org

Comment #41 on issue 56211 by allpra...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

I found a solution. Until they fix this, I only test for firefox and IE.

chro...@googlecode.com

unread,
Jul 2, 2013, 12:51:36 PM7/2/13
to chromi...@chromium.org

Comment #42 on issue 56211 by qasafek...@gmail.com: chrome.cookies fails
It clearly doesn't work, moving to another browser is our only option for
commercial product development. Hello, anybody home?

chro...@googlecode.com

unread,
Jul 11, 2013, 3:50:57 AM7/11/13
to chromi...@chromium.org

Comment #43 on issue 56211 by ice.sh...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Dear google you are WASTING our time.

chro...@googlecode.com

unread,
Jul 11, 2013, 5:24:39 AM7/11/13
to chromi...@chromium.org

Comment #44 on issue 56211 by kuh...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

RFC 2965 (http://tools.ietf.org/html/rfc2965), section 3.3.2
states "[reject cookie if] The value for the Domain attribute contains no
embedded dots, and the value is not .local".

Not sure, but that might be the reason why these cookies are rejected and
might answer comment #5. Would be nice to get that confirmed by Google...

chro...@googlecode.com

unread,
Aug 9, 2013, 5:47:37 AM8/9/13
to chromi...@chromium.org

Comment #45 on issue 56211 by TheKal...@gmail.com: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

same problem here. I really would like to use chrome when working on my
localhost ....

chro...@googlecode.com

unread,
Sep 11, 2013, 7:10:58 PM9/11/13
to chromi...@chromium.org

Comment #47 on issue 56211 by trongngu...@gmail.com: chrome.cookies fails
"+1 Me too ! "

chro...@googlecode.com

unread,
Sep 13, 2013, 2:36:36 PM9/13/13
to chromi...@chromium.org

Comment #48 on issue 56211 by account...@angmon.com: chrome.cookies fails
I have been using --enable-file-cookies on my shortcut and it allows me to
use local cookies. This might just be the fix you are looking for!

chro...@googlecode.com

unread,
Sep 13, 2013, 2:42:36 PM9/13/13
to chromi...@chromium.org

Comment #49 on issue 56211 by chris.sh...@gmail.com: chrome.cookies fails

chro...@googlecode.com

unread,
Sep 27, 2013, 2:19:34 PM9/27/13
to chromi...@chromium.org

Comment #50 on issue 56211 by china...@gmail.com: chrome.cookies fails
Needed because I work in locations where internet is often not available,
hence need local dev environments.

chro...@googlecode.com

unread,
Nov 26, 2013, 5:53:28 PM11/26/13
to chromi...@chromium.org

Comment #51 on issue 56211 by i...@getrailo.org: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Is this for real? How come the other browsers allow this and Chrome does
not?

I don't understand the rational behind rejecting this issue instead of
fixing it.

chro...@googlecode.com

unread,
Nov 26, 2013, 7:12:38 PM11/26/13
to chromi...@chromium.org

Comment #52 on issue 56211 by i...@getrailo.org: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

I guess the simplest fix is to add an entry to the hosts file, like

localhost.com 127.0.0.1

and then calling http://localhost.com/ instead of just localhost.

but having said that, this restriction is ridiculous IMO.

chro...@googlecode.com

unread,
Jun 26, 2014, 8:47:16 AM6/26/14
to chromi...@chromium.org

Comment #54 on issue 56211 by back...@elance-odesk.com: chrome.cookies
I'd love to hear explanation too. This is VERY annoying.

chro...@googlecode.com

unread,
Jun 27, 2014, 2:05:30 AM6/27/14
to chromi...@chromium.org

Comment #55 on issue 56211 by dmice...@1ps.ru: chrome.cookies fails for
localhost domains
http://code.google.com/p/chromium/issues/detail?id=56211

Just spend two hours trying to understand what is going on with a new
intranet test server.

#5 still need an answer!

chro...@googlecode.com

unread,
Jun 27, 2014, 3:41:56 AM6/27/14
to chromi...@chromium.org

Comment #56 on issue 56211 by jonathan...@gmail.com: chrome.cookies fails
#52 nailed it, i edit my hosts file to make things flow better in general

chro...@googlecode.com

unread,
Aug 25, 2014, 10:29:04 PM8/25/14
to chromi...@chromium.org

Comment #58 on issue 56211 by timematc...@gmail.com: chrome.cookies fails
for localhost domains
https://code.google.com/p/chromium/issues/detail?id=56211

I am not sure its relevant but i came to this article searching for the
similar issue. In my case i was passing localhost as Cookie domain and
testing on localhost. The Set-Cookie header was being passed to web browser
but cookie was not being created and was not being passed back to server on
subsequent requests.

I found this article on SOF
http://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain

which says
================
when working on localhost (!) the cookie-domain must be set to "" or NULL
or FALSE instead of "localhost"
================

Source of reference is:
http://curl.haxx.se/rfc/cookie_spec.html

This solution works fine for me.

I hope it helps someone...

Thanks

chro...@googlecode.com

unread,
Oct 4, 2014, 3:36:07 PM10/4/14
to chromi...@chromium.org

Comment #59 on issue 56211 by eljua...@gmail.com: chrome.cookies fails for
localhost domains
https://code.google.com/p/chromium/issues/detail?id=56211

Pls, answer #5.

chro...@googlecode.com

unread,
Oct 4, 2014, 5:55:18 PM10/4/14
to chromi...@chromium.org

Comment #60 on issue 56211 by jonathan...@gmail.com: chrome.cookies fails
why not just edit the hosts file and the vhosts file to match?

chro...@googlecode.com

unread,
Aug 19, 2015, 3:05:22 PM8/19/15
to chromi...@chromium.org

Comment #63 on issue 56211 by allpra...@gmail.com: chrome.cookies fails for
localhost domains
https://code.google.com/p/chromium/issues/detail?id=56211

they are very obviously oblivious to their user base or developers... which
is why I no longer give a crap what my sites look like in Chrome.

chro...@googlecode.com

unread,
Nov 7, 2015, 5:35:23 AM11/7/15
to chromi...@chromium.org

Comment #66 on issue 56211 by bugd...@chromium.org: chrome.cookies fails
for localhost domains
https://code.google.com/p/chromium/issues/detail?id=56211#c66

The following revision refers to this bug:

https://chromium.googlesource.com/chromium/src.git/+/e99453bd606cfba6902d82d1e363826d21b0c6a8

commit e99453bd606cfba6902d82d1e363826d21b0c6a8
Author: mkwst <mk...@chromium.org>
Date: Sat Nov 07 10:33:25 2015

Treat exact domain match cookies on public suffixes as host cookies.

Historically, we've rejected any cookie with a `domain` attribute for
hosts that we treat as public suffixes. This patch loosens that stance
by treating cookies whose domain attribute exactly matches the host as
host cookies.

This matches the language in step 5 of section 5.3 of RFC 6265
(https://tools.ietf.org/html/rfc6265#section-5.3), and
matches both Firefox and IE's behavior.

BUG=56211,551906
R=joc...@chromium.org,mme...@chromium.org

Review URL: https://codereview.chromium.org/1414603010

Cr-Commit-Position: refs/heads/master@{#358523}

[modify]
http://crrev.com/e99453bd606cfba6902d82d1e363826d21b0c6a8/net/cookies/canonical_cookie.cc
[modify]
http://crrev.com/e99453bd606cfba6902d82d1e363826d21b0c6a8/net/cookies/cookie_store_unittest.h
[modify]
http://crrev.com/e99453bd606cfba6902d82d1e363826d21b0c6a8/net/cookies/cookie_util.cc

chro...@googlecode.com

unread,
Nov 11, 2015, 2:40:09 AM11/11/15
to chromi...@chromium.org
Updates:
Status: Fixed
Owner: mk...@chromium.org
Labels: M-49

Comment #67 on issue 56211 by mk...@chromium.org: chrome.cookies fails for
localhost domains
https://code.google.com/p/chromium/issues/detail?id=56211

(No comment was entered for this change.)

chro...@googlecode.com

unread,
Nov 11, 2015, 2:42:25 AM11/11/15
to chromi...@chromium.org
Updates:
Cc: mk...@chromium.org bat...@chromium.org shi...@chromium.org
eisin...@chromium.org

Comment #68 on issue 56211 by mk...@chromium.org: chrome.cookies fails for
localhost domains
https://code.google.com/p/chromium/issues/detail?id=56211

Issue 551906 has been merged into this issue.

chro...@googlecode.com

unread,
Feb 16, 2016, 11:11:00 AM2/16/16
to chromi...@chromium.org

Comment #69 on issue 56211 by jambal...@gmail.com: chrome.cookies fails for
localhost domains
https://code.google.com/p/chromium/issues/detail?id=56211

wow really?
Reply all
Reply to author
Forward
0 new messages