CakePHP sends multiple lines of the same cookie information in the response header. What for?
I am having a problem with one of my cakePHP applications. My application displays a large html table on a page. I noticed that when the table goes beyond a certain size, IE cannot render that page. While trying to understand why this is happening, I noticed that the header of the html response contains a huge number of lines repeating the same thing.
Response Headers ------------------------------ Date Thu, 20 May 2010 04:18:10 GMT Server Apache / 2.0.63 (Win32) mod_ssl / 2.0.63 OpenSSL / 0.9.7m PHP / 5.2.10 X-Powered-By PHP / 5.2.10 P3P CP = "NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" Set-Cookie CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:12 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1; expires = Sun, 20-May-2035 10:18:13 GMT; path = / mywebapp Keep-Alive timeout = 15, max = 100 Connection Keep-Alive Transfer-Encoding chunked Content-Type text / html ================================================== ======================== Request Headers -------------------------- Host localhost: 8080 User-Agent Mozilla / 5.0 (Windows; U; Windows NT 5.1; en-US; rv: 1.9.2.3) Gecko / 20100401 Firefox / 3.6.3 (.NET CLR 3.5.30729) Accept text / html, application / xhtml + xml, application / xml; q = 0.9, * / *; q = 0.8 Accept-Language en-us, en; q = 0.5 Accept-Encoding gzip, deflate Accept-Charset ISO-8859-1, utf-8; q = 0.7, *; q = 0.7 Keep-Alive 115 Connection keep-alive Referer http: // localhost: 8080 / mywebapp / section2 / bigtable / 1 Cookie CAKEPHP = q4tp37tn9gkhcpgmf1ftr1i6c1 Authorization Basic cGt1bWFyYTpwa3VtYXJh
Notice the huge set of duplicate lines in the "Set-Cookie" in the response header. This only happens when trying to display large tables. Does anyone know what might be causing this? Any help to find the problem is appreciated.
I am using CakePHP 1.2.5. As far as I know, I haven't fiddled with any cookie functions. But yes, I am using session variables.
a source to share
Are you using requestAction()
? Then https://dev.cakephp.org/ticket/2886 can describe your problem.
I had a similar problem, where the header Set-Cookie
is repeated three times, apparently because the session has been launched as SessionComponent
well as SessionHelper
. I solved this by setting Session.start
in false
to config/core.php
and then calling $this->Session->activate()
manually once in AppController->beforeFilter()
.
Edit: Also see http://cakeqs.org/eng/questions/view/session_internals .
a source to share