<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SmartLogic Solutions Blog &#187; cookies</title>
	<atom:link href="http://blog.smartlogicsolutions.com/category/cookies/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.smartlogicsolutions.com</link>
	<description>News and updates from the people at SmartLogic Solutions</description>
	<lastBuildDate>Tue, 30 Nov 2010 21:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Problems with restful_authentication Plugin and Internet Explorer Cookies</title>
		<link>http://blog.smartlogicsolutions.com/2008/07/11/problems-with-restful_authentication-plugin-and-internet-explorer-cookies/</link>
		<comments>http://blog.smartlogicsolutions.com/2008/07/11/problems-with-restful_authentication-plugin-and-internet-explorer-cookies/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 20:52:27 +0000</pubDate>
		<dc:creator>John Trupiano</dc:creator>
				<category><![CDATA[cookies]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[John Trupiano]]></category>
		<category><![CDATA[restful_authentication]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.smartlogicsolutions.com/2008/07/11/problems-with-restful_authentication-plugin-and-internet-explorer-cookies/</guid>
		<description><![CDATA[I just ran into a fairly obscure bug. Bit me pretty good and stole an hour from me on an otherwise quiet Friday afternoon. How the Problem Manifested Itself: Using restful_authentication, I could log in fine using Firefox and Opera, but not Internet Explorer or Safari. I figured, it&#8217;s just an HTML POST, nothing special, [...]]]></description>
			<content:encoded><![CDATA[<p>I just ran into a fairly obscure bug.  Bit me pretty good and stole an hour from me on an otherwise quiet Friday afternoon.</p>
<p><strong>How the Problem Manifested Itself</strong>: Using <a href="http://agilewebdevelopment.com/plugins/restful_authentication">restful_authentication</a>, I could log in fine using Firefox and Opera, but not Internet Explorer or Safari.  I figured, it&#8217;s just an HTML POST, nothing special, so what could be going wrong?  I started to tail my logfile, and the session#create action was working properly.  It was redirecting to a protected page, signifying that the login was successful.  However, there was a second redirect occurring immediately after, sending me back to the login page.  Here&#8217;s a tail of the logfile:</p>
<p><span id="more-59"></span></p>
<pre>
Processing SessionsController#create (for xxx.xxx.xxx.xxxat 2008-07-11 16:09:32) [POST]
  Session ID: 8375beba8418d2f58363b1a05ea93c79
  Parameters: {"commit"=>"Log in", "action"=>"create", "controller"=>"sessions", "password"=>"xxx.xxx.xxx", "login"=>"xxx.xxx.xxx"}
  User Load (0.000701)   SELECT * FROM `users` WHERE (`users`.`login` = 'xxx.xxx.xxx') LIMIT 1
Redirected to http://xxx.xxx.xxx/dashboard
Completed in 0.00163 (611 reqs/sec) | DB: 0.00070 (42%) | 302 Found [http://xxx.xxx.xxx/session]

Processing DashboardController#index (for xxx.xxx.xxx.xxx at 2008-07-11 16:09:32) [GET]
  Session ID: 2a01076513064cce771c062a01da5e54
  Parameters: {"action"=>"index", "controller"=>"dashboard"}
Redirected to http://xxx.xxx.xxx/session/new
Filter chain halted as [#<ActionController::Filters::ClassMethods::SymbolFilter:0x7f4f3ef7d458 @filter=:login_required>] rendered_or_redirected.
Completed in 0.00043 (2309 reqs/sec) | DB: 0.00000 (0%) | 302 Found [http://xxx.xxx.xxx/dashboard]

Processing SessionsController#new (for xxx.xxx.xxx.xxx at 2008-07-11 16:09:32) [GET]
  Session ID: c8c497cb737dbb7a5977b76ef2a38a04
  Parameters: {"action"=>"new", "controller"=>"sessions"}
Rendering template within layouts/login
Rendering sessions/new
Completed in 0.00108 (928 reqs/sec) | Rendering: 0.00099 (92%) | DB: 0.00000 (0%) | 200 OK [http://xxx.xxx.xxx/session/new]
</pre>
<p>The first thing that caught my eye was &#8220;Filter chain halted&#8230;..&#8221;.  The login_required before_filter (used by restful_authentication) was failing despite the fact that I was able to successfully authenticate in the previous POST to session#create.  The next thing that caught my eye was the fact that each of the three requests above has a distinct session id.  This suggested to me that there was a problem with the session cookie being set.  A little bit of head scratching and several google searches later, I came upon&#8230;.</p>
<p><strong>The Real Problem</strong>: I was accessing the site through a domain name that contained an underscore (e.g. client_app.stagingdomain.com).  Why is this a problem?  Well, Internet Explorer (and I suppose Safari) <a href="http://support.microsoft.com/kb/909264">rejects cookies for domains that contain an underscore</a>.  Oddly enough, I found the solution on a <a href="http://groups.google.com/group/phusion-passenger/browse_thread/thread/24ce04b289d6c890">Passenger Forum Post</a>.</p>
<p>As soon as I changed the domain name through which I was accessing my staging server, the problem disappeared.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://blog.smartlogicsolutions.com/2007/06/12/struts-11-problems-with-logiciterate-tags-and-cannot-find-bean-xxx-under-any-scope/" rel="bookmark" class="crp_title">Struts 1.1: Problems with logic:iterate tags and &#8220;Cannot find bean XXX under any scope&#8221;</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/23/dont-abuse-the-session/" rel="bookmark" class="crp_title">Don&#8217;t Abuse the Session</a></li><li><a href="http://blog.smartlogicsolutions.com/2010/01/22/ubuntu-byobu-landscape/" rel="bookmark" class="crp_title">Using Byobu and Landscape to improve remote Ubuntu sessions</a></li><li><a href="http://blog.smartlogicsolutions.com/2009/03/13/slow-actions-in-rails-projects/" rel="bookmark" class="crp_title">Slow Actions in Rails Projects</a></li><li><a href="http://blog.smartlogicsolutions.com/2008/06/05/mapresources-and-custom-nested-routes/" rel="bookmark" class="crp_title">map.resources and custom nested routes</a></li><li>Powered by <a href="http://ajaydsouza.com/wordpress/plugins/contextual-related-posts/">Contextual Related Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://blog.smartlogicsolutions.com/2008/07/11/problems-with-restful_authentication-plugin-and-internet-explorer-cookies/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

