301 Redirect issues

52 views
Skip to first unread message

gaperez

unread,
Oct 11, 2011, 11:08:06 AM10/11/11
to Railo
I am using the following code on my site:

<cfheader statuscode="301" statustext="Moved Permanently">
<cfheader name="Location" value="#urltogoto#">
<cfabort>

But when I test the redirect using [http://www.rexswain.com/
httpview.html] the page loads up correctly but it returns a 302 status
code instead of a 301. Has anyone else had this problem, and more
importantly, has anyone figured out a solution to this?

Sean Daniels

unread,
Oct 12, 2011, 8:42:43 PM10/12/11
to ra...@googlegroups.com
Are you aware that you can now use the status code attribute with cflocation (as of ACF9, not sure how long Railo has supported)?

<cflocation url="[url]" statuscode="301">

Todd Rafferty

unread,
Oct 12, 2011, 10:35:23 PM10/12/11
to ra...@googlegroups.com
Regardless, if a statuscode of 301 is changing to 302, you need to open a ticket with sample code. I have a feeling the <cfabort> is messing you up.
--
~Todd Rafferty
Volunteer
Community Manager
Railo Server - Open Source
----

Michael Offner

unread,
Oct 13, 2011, 5:36:10 AM10/13/11
to ra...@googlegroups.com
i have tested your code and i get the following response header:

HTTP/1.1 301 Moved Permanently
Date: Thu, 13 Oct 2011 09:27:58 GMT
Server: Jetty/4.2.19 (Mac OS X/10.6.8 x86_64 java/1.6.0_26)
Content-Type: text/html; charset=UTF-8
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: CFID=a303e416-8f13-4dd7-b460-db26efef9f5a;Path=/;Expires=Fri, 11-Oct-41 17:19:28 GMT
Set-Cookie: CFTOKEN=0;Path=/;Expires=Fri, 11-Oct-41 17:19:28 GMT
Location: move.cfm
Content-Length: 1

Looks fine to me. the headers set with cfheader are forwarded to the servlet engine 1 to 1 without a conversion from Railo, cfabort does not affect the status code set. Railo does not change the staus code from 301 to 302, without this is made in the cfml code, about that i'm a 99% sure.

i'm 99% sure that this change of the response header is made by the servlet engine or the web server (if there is one).

/micha

2011/10/11 gaperez <gape...@gmail.com>
Reply all
Reply to author
Forward
0 new messages