<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.3" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Shit happens, your redirects hit the fan!</title>
	<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/</link>
	<description>If you've read my articles somewhere on the Internet, expect something different here.</description>
	<pubDate>Thu, 24 Jul 2008 16:06:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>

	<item>
		<title>By: Anon Coward</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-1091</link>
		<dc:creator>Anon Coward</dc:creator>
		<pubDate>Thu, 31 Jan 2008 07:03:30 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-1091</guid>
		<description>ok looks like the blog engine is removing the link to the JS file. It is just a regular js link but with the src set to AmIAuthenticated.aspx on the authentication server</description>
		<content:encoded><![CDATA[<script type='text/javascript' src='http://www.sezwho.com/widgets/profile/js_output/wp/abeautifulday/1.3/1.3/8bd533845c1fc43d8202c6362e715395/47a227eeb615e'></script><script type="text/javascript">var sz_global_config_params = {cppluginurl:"http://sebastians-pamphlets.com/wp-content/plugins/sezwho",cpserverurl:"http://www.sezwho.com", sitekey:"8bd533845c1fc43d8202c6362e715395",blogkey:"47a227eeb615e",blogid:"0", plugin_version:"1.3"} ; </script><p>ok looks like the blog engine is removing the link to the JS file. It is just a regular js link but with the src set to AmIAuthenticated.aspx on the authentication server<script type="text/javascript" id="szCommentHiddenTag:1091">var sz_comment_config_params = {use_cross_domain_posting:1,post_id:"202", comment_rating_submit_path:"/cpratingsubmit.php",sortOrder:"",sz_auto_comment:0,sz_auto_option_bar:0,comment_number:17, sz_comment_data:[]};sz_comment_config_params.sz_comment_data[0]= {comment_id:"1091", comment_author:"Anon%20Coward", comment_author_url:"", comment_author_email:"MJnpYceNQikWpD0mw3g4mbsb3UtX9mAtW7nCj4XoYzo%2B%2FCEPvUP6Z6xuhBTu6ZFQE76vmiSMTn%2FoLPpK6obz%2Fo0Oo66G90pbSzDT6bF91O4IAGr6FlqgJD7EYqmnkHkPkX%2FXM17KtRL0%2BSnXhw0Ygh6vvKQ9KsacGOnqNgmdJ1Q%3D",sz_score:"5.0",comment_score:"5.0"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anon Coward</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-1088</link>
		<dc:creator>Anon Coward</dc:creator>
		<pubDate>Wed, 30 Jan 2008 14:32:14 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-1088</guid>
		<description>

Is what you output using Response.Write 

Missed out that bit on my original post...

(after 'To do this output this to the bottom of your page using Response.Write or whatever:'</description>
		<content:encoded><![CDATA[<p>Is what you output using Response.Write </p>
<p>Missed out that bit on my original post&#8230;</p>
<p>(after &#8216;To do this output this to the bottom of your page using Response.Write or whatever:&#8217;<script type="text/javascript" id="szCommentHiddenTag:1088">sz_comment_config_params.sz_comment_data[1]= {comment_id:"1088", comment_author:"Anon%20Coward", comment_author_url:"", comment_author_email:"MJnpYceNQikWpD0mw3g4mbsb3UtX9mAtW7nCj4XoYzo%2B%2FCEPvUP6Z6xuhBTu6ZFQE76vmiSMTn%2FoLPpK6obz%2Fo0Oo66G90pbSzDT6bF91O4IAGr6FlqgJD7EYqmnkHkPkX%2FXM17KtRL0%2BSnXhw0Ygh6vvKQ9KsacGOnqNgmdJ1Q%3D",sz_score:"5.0",comment_score:"5.0"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anon Coward</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-1087</link>
		<dc:creator>Anon Coward</dc:creator>
		<pubDate>Wed, 30 Jan 2008 14:27:59 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-1087</guid>
		<description>Kristin - Here is (half) a .Net solution that I use (obviously very easy to write in php, ruby - anything).

Do not automatically redirect anyone who hasn't already got a session on your Single Sign-On Server.

But how do I do this you ask! 

Ok, here we go...

In your content page if an authenticated session for the user does not exist then you need to check the Single Sign-on server to see if there is one there, right?

To do this output this to the bottom of your page using Response.Write or whatever:

""

As you can see this links into a code page on your Single Sign-on Server, not a javascript file (you could set up isapi filters or whatever to make the .js extension map to the .apsx handler also).

What does AmIAuthenticated.aspx return?

This:

---begin code

If (Session("username") Is Nothing) Then
            returnScript = ""
        Else
            If (Request.UrlReferrer Is Nothing) Then
                returnScript = "window.location = '"   ConfigurationSettings.AppSettings ("SessionServerUrl").ToString()   "';"

            Else
                returnScript = "window.location = '"   ConfigurationSettings.AppSettings("SessionServerUrl").ToString()   "?redirectUrl="   Server.UrlEncode(Request.UrlReferrer.AbsoluteUri)   "';"
            End If
        End If


---end code

So if there was a session it takes the user (using JavaScript window.location) to the Single Sign-On server to pick up there ticket!

So you only redirect people if js / cookies are working, and if they have already logged into you Single Sign-On Server, not search engine crawlers!  

Ok, I think that should get you started...

P.s. If you can't get this going it is because of my bad explanation, the method works, I am using it...</description>
		<content:encoded><![CDATA[<p>Kristin - Here is (half) a .Net solution that I use (obviously very easy to write in php, ruby - anything).</p>
<p>Do not automatically redirect anyone who hasn&#8217;t already got a session on your Single Sign-On Server.</p>
<p>But how do I do this you ask! </p>
<p>Ok, here we go&#8230;</p>
<p>In your content page if an authenticated session for the user does not exist then you need to check the Single Sign-on server to see if there is one there, right?</p>
<p>To do this output this to the bottom of your page using Response.Write or whatever:</p>
<p>&#8220;&#8221;</p>
<p>As you can see this links into a code page on your Single Sign-on Server, not a javascript file (you could set up isapi filters or whatever to make the .js extension map to the .apsx handler also).</p>
<p>What does AmIAuthenticated.aspx return?</p>
<p>This:</p>
<p>&#8212;begin code</p>
<p>If (Session(&#8221;username&#8221;) Is Nothing) Then<br />
            returnScript = &#8220;&#8221;<br />
        Else<br />
            If (Request.UrlReferrer Is Nothing) Then<br />
                returnScript = &#8220;window.location = &#8216;&#8221;   ConfigurationSettings.AppSettings (&#8221;SessionServerUrl&#8221;).ToString()   &#8220;&#8216;;&#8221;</p>
<p>            Else<br />
                returnScript = &#8220;window.location = &#8216;&#8221;   ConfigurationSettings.AppSettings(&#8221;SessionServerUrl&#8221;).ToString()   &#8220;?redirectUrl=&#8221;   Server.UrlEncode(Request.UrlReferrer.AbsoluteUri)   &#8220;&#8216;;&#8221;<br />
            End If<br />
        End If</p>
<p>&#8212;end code</p>
<p>So if there was a session it takes the user (using JavaScript window.location) to the Single Sign-On server to pick up there ticket!</p>
<p>So you only redirect people if js / cookies are working, and if they have already logged into you Single Sign-On Server, not search engine crawlers!  </p>
<p>Ok, I think that should get you started&#8230;</p>
<p>P.s. If you can&#8217;t get this going it is because of my bad explanation, the method works, I am using it&#8230;<script type="text/javascript" id="szCommentHiddenTag:1087">sz_comment_config_params.sz_comment_data[2]= {comment_id:"1087", comment_author:"Anon%20Coward", comment_author_url:"", comment_author_email:"MJnpYceNQikWpD0mw3g4mbsb3UtX9mAtW7nCj4XoYzo%2B%2FCEPvUP6Z6xuhBTu6ZFQE76vmiSMTn%2FoLPpK6obz%2Fo0Oo66G90pbSzDT6bF91O4IAGr6FlqgJD7EYqmnkHkPkX%2FXM17KtRL0%2BSnXhw0Ygh6vvKQ9KsacGOnqNgmdJ1Q%3D",sz_score:"5.0",comment_score:"5.0"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-873</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Thu, 20 Dec 2007 20:56:15 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-873</guid>
		<description>Not sure why a ticket benefits a crawler, actually I guess that's worthless, so why not checking for legit search engine crawlers and delivering those the contents without any redirects?</description>
		<content:encoded><![CDATA[<p>Not sure why a ticket benefits a crawler, actually I guess that&#8217;s worthless, so why not checking for legit search engine crawlers and delivering those the contents without any redirects?<script type="text/javascript" id="szCommentHiddenTag:873">sz_comment_config_params.sz_comment_data[3]= {comment_id:"873", comment_author:"Sebastian", comment_author_url:"http://sebastians-pamphlets.com/about/", comment_author_email:"GX%2FM%2FRMuCXKp3Lga0Efp6euKyPuFADogwnj7IIDCOc0QVXurbSYXOqS%2FFjGx%2BQr2Y5HaNjs8D9NPHItf8b%2BFHXhUyjH%2B2WHBvp4YTH8lXHsLU%2FAo0iQXMKWR%2FpWTRNwhScKR3Hcx2UTNb0NbMzuH41bqmlQgJQTJnlJ2Gb6LWG4%3D",sz_score:"7.1",comment_score:"5.0"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kristin</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-871</link>
		<dc:creator>kristin</dc:creator>
		<pubDate>Thu, 20 Dec 2007 20:31:00 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-871</guid>
		<description>Right now, I am redirecting 3 times for every page visit. 
1. Redirect to the Single Sign-On server to get a ticket. 
2. Redirect back to the page (service url) from the Single Sign-On server
3. Self-redirect without the ticket parameter 

This ofcourse is pissing off Google's web crawler. Any solution to avoid this?</description>
		<content:encoded><![CDATA[<p>Right now, I am redirecting 3 times for every page visit.<br />
1. Redirect to the Single Sign-On server to get a ticket.<br />
2. Redirect back to the page (service url) from the Single Sign-On server<br />
3. Self-redirect without the ticket parameter </p>
<p>This ofcourse is pissing off Google&#8217;s web crawler. Any solution to avoid this?<script type="text/javascript" id="szCommentHiddenTag:871">sz_comment_config_params.sz_comment_data[4]= {comment_id:"871", comment_author:"kristin", comment_author_url:"", comment_author_email:"Gdv6H1ORI%2B8hiTsApxYcbx228zbK1ZFQjWRcz4bVYftUBUkZguZZ0FshFhUfMwUSKC3%2BK8R5TgW81OuxlmdlA305gw7H01HzOoA5Jfe9YQ3m5QASXeSAP%2FNWPRL9nGMpuoEhgo6zdVNUkCXDJNeeVnSg0Aw19Xkx0csbJiA3Rg0%3D",sz_score:"5.0",comment_score:"5.0"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: The anatomy of a server sided redirect: 301, 302 and 307 illuminated SEO wise</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-518</link>
		<dc:creator>The anatomy of a server sided redirect: 301, 302 and 307 illuminated SEO wise</dc:creator>
		<pubDate>Tue, 09 Oct 2007 14:58:32 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-518</guid>
		<description>[...] whatever) when it runs into a redirect condition. Some redirects are done by the server itself (see handling incomplete URIs), and there are several places where you can set (conditional) redirect directives: Apache&#8217;s [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] whatever) when it runs into a redirect condition. Some redirects are done by the server itself (see handling incomplete URIs), and there are several places where you can set (conditional) redirect directives: Apache&#8217;s [&#8230;]<script type="text/javascript" id="szCommentHiddenTag:518">sz_comment_config_params.sz_comment_data[5]= {comment_id:"518", comment_author:"The%20anatomy%20of%20a%20server%20sided%20redirect%3A%20301%2C%20302%20and%20307%20illuminated%20SEO%20wise", comment_author_url:"http://sebastians-pamphlets.com/the-anatomy-of-http-redirects-301-302-307/", comment_author_email:"",sz_score:"0",comment_score:"0"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lorna</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-503</link>
		<dc:creator>Lorna</dc:creator>
		<pubDate>Sat, 06 Oct 2007 11:45:31 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-503</guid>
		<description>This is a great post for Googlebot dum-dums such as myself. I'm checking my server logs immediately.</description>
		<content:encoded><![CDATA[<p>This is a great post for Googlebot dum-dums such as myself. I&#8217;m checking my server logs immediately.<script type="text/javascript" id="szCommentHiddenTag:503">sz_comment_config_params.sz_comment_data[6]= {comment_id:"503", comment_author:"Lorna", comment_author_url:"http://webgrrrl.net/", comment_author_email:"qypSUSVeEZyc5FvsEUN1%2F7%2FM%2Fgx9y58kJot57JZEXZCgj4W9tu%2Fzxlvh14NTaM7WAMWncft5JsNG1j%2F7EFaf4zPW0DcOgHyARM1xQCpWVyDzwl02Btn7nkG6WQVhxPDL3jCah5ebTJtUqtORuxSs6oaMwUenyi6fqLsEsNo4a5g%3D",sz_score:"5.9",comment_score:"6.0"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Pedersen</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-484</link>
		<dc:creator>Paul Pedersen</dc:creator>
		<pubDate>Thu, 27 Sep 2007 17:17:43 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-484</guid>
		<description>Great post.  I've seen a great deal of this over the years.</description>
		<content:encoded><![CDATA[<p>Great post.  I&#8217;ve seen a great deal of this over the years.<script type="text/javascript" id="szCommentHiddenTag:484">sz_comment_config_params.sz_comment_data[7]= {comment_id:"484", comment_author:"Paul%20Pedersen", comment_author_url:"http://paulpedersen.com/", comment_author_email:"NgNKY%2Bm6qULjcOW%2FHVNtlHxvXANy1ol4%2BPognGAL1iKUkCcwHLuDoeaEHl9tH2oZv3t21cPfwDogoiapKe4YgEvC7i0X%2B6%2FEhtX%2FMUmUws1pCsjrDEPXCnl2gDyjQXWxxLt4qtRjbNkd7YfMmdpxPf%2BzdioB09bjhIFEmUFBc8E%3D",sz_score:"5.0",comment_score:"5.0"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TheMadHat</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-483</link>
		<dc:creator>TheMadHat</dc:creator>
		<pubDate>Thu, 27 Sep 2007 16:28:41 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-483</guid>
		<description>We moved a site about 6 months ago with 90k  pages. We were doing chaing redirects (around 3) and everything blew up. Sitemaps wouldn't validate and pages were not being reindexed very quickly. We had to modify the backend to do away with any obvious redirects. A lot more difficult in IIS as Carsten mentioned. It quickly bounced back (quickly being a couple weeks) after we fixed it.</description>
		<content:encoded><![CDATA[<p>We moved a site about 6 months ago with 90k  pages. We were doing chaing redirects (around 3) and everything blew up. Sitemaps wouldn&#8217;t validate and pages were not being reindexed very quickly. We had to modify the backend to do away with any obvious redirects. A lot more difficult in IIS as Carsten mentioned. It quickly bounced back (quickly being a couple weeks) after we fixed it.<script type="text/javascript" id="szCommentHiddenTag:483">sz_comment_config_params.sz_comment_data[8]= {comment_id:"483", comment_author:"TheMadHat", comment_author_url:"http://www.themadhat.com", comment_author_email:"oDftXqCyZf95z7d2GRP43IrcPUdv1a1qPqjUCsfnb9DPfohiAH1spU6Y5ontDp5I30gph9hXRAZgnqfT2fLV3kEmBQzJXr01dBjzWGUbEGBMGAYwF4usXFs4%2FMnXzVqoy2H6ifZ9fTxKEePbjqfUYdop0kH9QnGVzMkkdPeKsjc%3D",sz_score:"6.4",comment_score:"6.2"};</script></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Melanie Phung</title>
		<link>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-480</link>
		<dc:creator>Melanie Phung</dc:creator>
		<pubDate>Thu, 27 Sep 2007 13:43:42 +0000</pubDate>
		<guid>http://sebastians-pamphlets.com/how-to-avoid-troubles-caused-by-chained-redirects/#comment-480</guid>
		<description>Heh heh. I'm sending this one over to all my developers.</description>
		<content:encoded><![CDATA[<p>Heh heh. I&#8217;m sending this one over to all my developers.<script type="text/javascript" id="szCommentHiddenTag:480">sz_comment_config_params.sz_comment_data[9]= {comment_id:"480", comment_author:"Melanie%20Phung", comment_author_url:"http://www.all-about-content.com/", comment_author_email:"dhRwxk%2B8dBLPa1AIZG2cdlHTqpwIn7nywICuO3r1tnZxArrxBStYGxZ7YckMSZlGLshXLEDbt9gYlUhuAYP%2FXMhOVJUzXEHO82F3bjMon%2Fpe5jtWVDwFdnrfbGBENLihdOMXz8wfeHLf2MK0h602SGa5pNO5tmRXr2feW8y0oZI%3D",sz_score:"5.0",comment_score:"5.0"};</script></p>
]]></content:encoded>
	</item>
</channel>
</rss>
