Coldfusion migration from Windows to Linux - problem
Copy link to clipboard
Copied
We have recently moved our website hosting from a Windows based server at one company to a Linux based server at a different hosting company. I have made the neccessary changes to Coldfusion (application.cfm to Application.cfm, etc.) And most of our site works fine. There is one area, though, that is still giving me some problems.
We have a site management area that allows us to log in and update ads and subscriptions. However, this part of our site is not working. When we try to get into that error, we recieve an error message. In Firefox, the error states: "Firefox has detected that the server is redirecting the request for this address in a way that will never complete."
The only code changes I made were to correct the case sensitive parts of of the code. No other changes were made. Does anyone have an idea if there is something else I need to look at that would cause this problem with Linux and not Windows?
Thanks.
Jason
Copy link to clipboard
Copied
That error usually indicates and endless relocation loop. I.E page A is relocating to page B which relocates to page A.
Copy link to clipboard
Copied
Yeah, I've been looking at that for days and I cannot, for the life of me, find anything that would be redirecting it that way. Guess I need to look at it again, even more closely.
Thanks!
Jason
Copy link to clipboard
Copied
By the way, here are the three files where I think the problem resides. Hope you can help a blind man!
Copy link to clipboard
Copied
No files
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I'll do it like this:
Here's the home.cfm file:
<cfparam name="form.action" default="">
<cfset message = "">
<cfif form.action IS "update">
<cfquery datasource="#Application.ds#" username="#Application.dsUserName#" password="#Application.dsPassword#" name="updateSettings">
UPDATE settings SET issue = '#form.issue#', volume = '#form.volume#', number = '#form.number#'
</cfquery>
<cfset message = "Current Issue Updated">
</cfif>
<cfquery datasource="#Application.ds#" username="#Application.dsUserName#" password="#Application.dsPassword#" name="getSettings">
SELECT issue,volume,number FROM settings
</cfquery>
<div style="color:red;"><cfoutput>#message#</cfoutput></div>
<form action="index.cfm" method="post">
<p><strong>Current Issue:</strong> <input type="text" size="50" maxlength="50" name="issue" value="<cfoutput>#getSettings.issue#</cfoutput>" /></p>
<p><strong>Volume:</strong> <input type="text" size="15" maxlength="50" name="volume" value="<cfoutput>#getSettings.volume#</cfoutput>" /></p>
<p><strong>Number:</strong> <input type="text" size="15" maxlength="50" name="number" value="<cfoutput>#getSettings.number#</cfoutput>" /></p>
<p><input type="submit" name="submit" value=" Update " /></p>
<input type="hidden" name="action" value="update" />
</cfform>
Copy link to clipboard
Copied
Here's index.cfm
<cfparam name="attributes.header_footer" default="yes">
<cfparam name="attributes.method" default="home">
<cfparam name="attributes.pageName" default="">
<cfswitch expression="#attributes.method#">
<cfcase value="users">
<cflocation url="#Application.managementUrl#/users/index.cfm" addtoken="No">
</cfcase>
<cfcase value="home">
<cfset page = "home.cfm">
<cfset attributes.pageName = "Home">
</cfcase>
<cfcase value="logout">
<cfset page = "logout.cfm">
<cfset attributes.header_footer = "no">
</cfcase>
<cfdefaultcase>
<cfset page = "home.cfm">
<cfset attributes.pageName = "Home">
</cfdefaultcase>
</cfswitch>
<cfif attributes.header_footer IS "no">
<cfinclude template="#page#">
<cfelse>
<cfinclude template="header.cfm">
<cfinclude template="#page#">
<cfinclude template="footer.cfm">
</cfif>
Copy link to clipboard
Copied
Finally, here's login.cfm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Boats & Harbors Management Console</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
</head>
<body>
<CFIF isdefined("ATTEMPT_LOGIN.X")>
<cfquery datasource="#Application.ds#" username="#Application.dsUserName#" password="#Application.dsPassword#" name="validate_user" maxrows="1">
SELECT usersID, usersUsername
FROM adminusers
WHERE usersUsername = '#attributes.username#'
AND usersPassword = '#attributes.password#'
</cfquery>
<CFIF validate_user.recordcount GT 0>
<cfset session.usersID = validate_user.usersID>
<cfset session.username = validate_user.usersuserName>
<cfset session.adminlogged_in = "yes">
<cflocation url="#Application.managementUrl#/index.cfm" addtoken="No">
<CFELSE>
<cfset error = "yes">
</CFIF>
</CFIF>
<p> </p>
<table width="350" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#4369AA">
<tr>
<td><table width="350" border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#4369A5">
<tr>
<td><img src="contentmanagement.jpg" width="324" height="195"></td>
</tr>
<tr>
<td>
<cfif isdefined("error")>
<b class="style1" style="color:red">Sorry, but that Username/Password combination doesn't exist in our database.</b>
</cfif>
<cfform name="form" method="post" action="<cfoutput>#Application.managementUrl#/login.cfm</cfoutput>">
<table border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<TD align="right"><b class="style1">Username:</b></TD>
<TD><input type="Text" name="username"></TD>
</tr>
<TR>
<TD align="right"><b class="style1">Password:</b></TD>
<TD><input type="password" name="password"></TD>
</TR>
<TR align="center">
<TD colspan="2"><font color="#FF0000" size="1">
<br>
<input type="image" src="btnLogin.jpg" name="ATTEMPT_LOGIN" value=" LOGIN " width="134" height="40">
</font></TD>
</TR>
</table>
</cfform>
</td>
</tr>
<tr>
<td align="center" valign="top" class="style1">Boats & Harbors Management Console</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Copy link to clipboard
Copied
Use something like "Live HTTP Headers", a Firefox Plugin, it should tell you what is redirecting to where.
Copy link to clipboard
Copied
You want to focus on those <cflocation...> tags. Are the variables properly defined, are they going where they are supposed to go. Somewhere in there is an endless loop of redirects.
Copy link to clipboard
Copied
Thanks. I'll refocus in those areas. I appreciate the help!
Copy link to clipboard
Copied
Pay close attention to any redirects in an Application.cfm/cfc file.
It is a common error where one has login logic in an Application.cfm or cfc file that redirects to a login form. But when the form page is requested, the Application file is included and the file is redirected to the loging form because the user is not logged in. But before the form is dispayed the Application file is included and the file is redirected to the login form because the user is not loged in. Ad infinitum.
One, of many, method to prevent this endless loop is that the redirect logic is wrapped in a <cfif...> block that tests that the file that is being reqeusted is not the login form before redirecting the user to the login form. If this test of the file name is case sensitive and you changed the case of a relevant file, that could have caused this problem.
Copy link to clipboard
Copied
Ahhh. Good point. I'll double check that as well.
Jason
Date: Wed, 4 Nov 2009 08:20:44 -0700
From: forums@adobe.com
To: jew0312@live.com
Subject: Coldfusion migration from Windows to Linux - problem
Pay close attention to any redirects in an Application.cfm/cfc file.
It is a common error where one has login logic in an Application.cfm or cfc file that redirects to a login form. But when the form page is requested, the Application file is included and the file is redirected to the loging form because the user is not logged in. But before the form is dispayed the Application file is included and the file is redirected to the login form because the user is not loged in. Ad infinitum.
One, of many, method to prevent this endless loop is that the redirect logic is wrapped in a <cfif...> block that tests that the file that is being reqeusted is not the login form before redirecting the user to the login form. If this test of the file name is case sensitive and you changed the case of a relevant file, that could have caused this problem.
>
Copy link to clipboard
Copied
The only code changes I made were to correct the case sensitive parts of of the code. No other changes were made. Does anyone have an idea if there is something else I need to look at that would cause this problem with Linux and not Windows?
Your web server has changed as well, as well as your CF install. How did you migrate all the settings from one CF server to the new one? Have you checked your Apache config for incorrect aliasing or any other sort of mis-config that could be interfering.
It's not likely to be our code because that's the one thing that hasn't changed (beyond casing issues).
It might pay to do a source control check-out the old version of your code (the production code from the windows box) to a temp dir, then chuck the current production files over the top, and do a diff on each modified file to make sure when fixing casing issues you didn't inadvertantly change an entire file by accident or something (careless copy and paste or that sort of thing).
--
Adam
Copy link to clipboard
Copied
The thread has been marked as answered, but the poster did not indicate what the answer actually was so I wonder what the issue turned out to be.
Copy link to clipboard
Copied
According to our hosting provider, they have checked the apache config and have found nothing wrong. Of course, I cannot verify this as I do not have access to the server config files.
As for the settings, I received an email from our previous provider that included the settings that needed to be set and provided that to our current provider during setup.
Jason
Date: Wed, 4 Nov 2009 10:58:38 -0700
From: forums@adobe.com
To: jew0312@live.com
Subject: Coldfusion migration from Windows to Linux - problem
The only code changes I made were to correct the case sensitive parts of of the code. No other changes were made. Does anyone have an idea if there is something else I need to look at that would cause this problem with Linux and not Windows?
Your web server has changed as well, as well as your CF install. How did you migrate all the settings from one CF server to the new one? Have you checked your Apache config for incorrect aliasing or any other sort of mis-config that could be interfering.
It's not likely to be our code because that's the one thing that hasn't changed (beyond casing issues).
It might pay to do a source control check-out the old version of your code (the production code from the windows box) to a temp dir, then chuck the current production files over the top, and do a diff on each modified file to make sure when fixing casing issues you didn't inadvertantly change an entire file by accident or something (careless copy and paste or that sort of thing).
--
Adam
>
Copy link to clipboard
Copied
According to our hosting provider, they have checked the apache config and have found nothing wrong. Of course, I cannot verify this as I do not have access to the server config files.
Well they would say that. Especially if saying that is what's most likely to make you go away so there's no risk of them having to do any investigation or work.
Tell them to send you the config files.
As for the settings, I received an email from our previous provider that included the settings that needed to be set and provided that to our current provider during setup.
That's a bit slack. I would have thought they'd given you a .car file.
So do you know all your CF mappings and custom tag paths and what not are the same on both environments (well: allowing for OS and diretcory structure differences).
And as Ian asked... you've marked this thread as resolved. Am I wasting my time following this up? Is it sorted? Or was marking Ian's post about the endless loop thing as the resolution an accident?
--
Adam
Copy link to clipboard
Copied
Yes, that was an accident. I am still trying to figure this out. I did not mean to mark it as resolved.
I am 99% certain th ecf mappings and such are the same on both environments. I am going to send them an email now asking for the config files.
Jason
Date: Wed, 4 Nov 2009 12:21:45 -0700
From: forums@adobe.com
To: jew0312@live.com
Subject: Coldfusion migration from Windows to Linux - problem
According to our hosting provider, they have checked the apache config and have found nothing wrong. Of course, I cannot verify this as I do not have access to the server config files.
Well they would say that. Especially if saying that is what's most likely to make you go away so there's no risk of them having to do any investigation or work.
Tell them to send you the config files.
As for the settings, I received an email from our previous provider that included the settings that needed to be set and provided that to our current provider during setup.
That's a bit slack. I would have thought they'd given you a .car file.
So do you know all your CF mappings and custom tag paths and what not are the same on both environments (well: allowing for OS and diretcory structure differences).
And as Ian asked... you've marked this thread as resolved. Am I wasting my time following this up? Is it sorted? Or was marking Ian's post about the endless loop thing as the resolution an accident?
--
Adam
>
Copy link to clipboard
Copied
Yes, that was an accident. I am still trying to figure this out. I did not mean to mark it as resolved.
OK, cool.
You don't have a custom 404 handler that points to a missing file or something, do you (which could be picked up by the 404 handler...)?
Or something that relies on a session variable being set which - if not - redirects to another page which is inadvertantly "trapped" by the same logic?
Are you sure you have correctly renamed all your Application.cfc, Application.cfm and OnRequestEnd.cfm files?
Is there some other casing issue which is causing an error which is being trapped and redirected into a loop?
You'll need to check all your paths for <cfinclude>, <cfmodule>, <cffile>, CFC references like in createObject(), etc.
Have you done what I suggested and done a diff on the old production code and the current code to make sure you haven't accidentally changed somethig inappropriately?
--
Adam
Copy link to clipboard
Copied
I have done the diff and nothing showed up. Just the case changes I mentioned. We have a custom 404 page that will show instead of the normal file not found message.
No other casing issues that I am aware of. And we do not require users to login to our site, so the only session variables I know of are the ones in the management area, which is where this problem is. I will go back and check all the cf tags to make sure I didn't miss anything. Of course, my eyes have been getting more crossed the more i look at this!
I do know for a fact that the Application and OnRequestEnd files have been renamed properly, though.
I really do appreciate this help!
Jason
Date: Wed, 4 Nov 2009 12:43:24 -0700
From: forums@adobe.com
To: jew0312@live.com
Subject: Coldfusion migration from Windows to Linux - problem
Yes, that was an accident. I am still trying to figure this out. I did not mean to mark it as resolved.
OK, cool.
You don't have a custom 404 handler that points to a missing file or something, do you (which could be picked up by the 404 handler...)?
Or something that relies on a session variable being set which - if not - redirects to another page which is inadvertantly "trapped" by the same logic?
Are you sure you have correctly renamed all your Application.cfc, Application.cfm and OnRequestEnd.cfm files?
Is there some other casing issue which is causing an error which is being trapped and redirected into a loop?
You'll need to check all your paths for <cfinclude>, <cfmodule>, <cffile>, CFC references like in createObject(), etc.
Have you done what I suggested and done a diff on the old production code and the current code to make sure you haven't accidentally changed somethig inappropriately?
--
Adam
>
Copy link to clipboard
Copied
Have you tried something to view the headers being sent to the client? That should at least tell you what file(s) are involved in the loop.
Copy link to clipboard
Copied
Yes, I have. Here is what Live HTTP Headers gave me: It's like login.cfm is redirecting to itself on and on....
https://www.boats-and-harbors.com/manage
GET /manage HTTP/1.1
Host: www.boats-and-harbors.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.4) Gecko/20091016 Firefox/3.5.4
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: 300
Connection: keep-alive
Cookie: CFID=903714; CFTOKEN=ad446224ec1281b1-19B2348E-1320-1266-5E86C3FEC82CB8EF; __utma=57557817.973845258665749000.1250266593.1257353323.1257357203.236; __utmz=57557817.1255531971.166.3.utmcsr=hostingmanager.secureserver.net|utmccn=(referral)|utmcmd=referral|utmcct=/ErrorLog.aspx; CFGLOBALS=urltoken%3DCFID%23%3D903714%26CFTOKEN%23%3Dad446224ec1281b1%2D19B2348E%2D1320%2D1266%2D5E86C3FEC82CB8EF%23lastvisit%3D%7Bts%20%272009%2D11%2D04%2013%3A38%3A40%27%7D%23timecreated%3D%7Bts%20%272009%2D09%2D16%2005%3A04%3A23%27%7D%23hitcount%3D2602%23cftoken%3Dad446224ec1281b1%2D19B2348E%2D1320%2D1266%2D5E86C3FEC82CB8EF%23cfid%3D903714%23; __utmc=57557817
HTTP/1.x 301 Moved Permanently
Date: Wed, 04 Nov 2009 20:40:41 GMT
Server: Apache
Location: https://www.boats-and-harbors.com/manage/
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1
Copy link to clipboard
Copied
Hang on. On one hand you say you don't require uses to login to your site. Then in your next post you're talking about login.cfm...?
I'm confused.
--
Adam
Copy link to clipboard
Copied
It is an 'Aministration' section of the site, the general public portion of the site does not require login.


-
- 1
- 2