trouble on redirect_to's

djsodom

Active Member
#1
I've narrowed down the problem I've been having with litespeed to methods where I am using redirect_to. For example, something like:

def create
@workbook.track_results(params[:answer_id])
if @workbook.total == @workbook.items.size
redirect_to history_url(@workbook.game)
else
redirect_to quiz_url(@workbook.items[@workbook.total])
end
end

Maybe 50% of the time with litespeed the redirects die and nothing happens. For example, there is no response listed in firebug. I have no problem with webrick or lightty.

Any ideas what this could be?

Here is an output from my rails development log:

Code:
Processing HistoriesController#create (for 127.0.0.1 at 2006-09-11 17:06:15) [POST]
  Session ID: 5eeed2ea942628caabd47d2066deff40
  Parameters: {"action"=>"create", "id"=>"25", "answer_id"=>"3", "controller"=>"histories"}
  History Columns (0.003766)   SHOW FIELDS FROM histories
  SQL (0.000208)   BEGIN
 UPDATE users SET `created_at` = '2006-05-23 18:45:41', `play_total` = 10, `login` = 'thomasB', `crypted_password` = 'a0fb71a7ec39a1c2267438c81f647e8fb18cf9fb', `bio` = '', `create_count` = 13, `remember_token_expires_at` = NULL, `salt` = '4dd6bb2d535ab77097623fa7c8856c364aead978', `play_correct` = 10, `edit_count` = 111, `remember_token` = NULL, `note` = '', `is_stats_visible` = 1, `email` = 'thomasb@gmail.com', `password_reset_code` = NULL, `updated_at` = '2006-09-11 17:06:15' WHERE id = 9
  SQL (0.000647)   COMMIT
Redirected to http://localhost:3000/histories/0911061706086998
Completed in 0.07699 (12 reqs/sec) | DB: 0.02403 (31%) | 302 Found
Thanks
Steve
 

mistwang

LiteSpeed Staff
#2
Maybe the redirect URL is mis-formated under LiteSpeed LSAPI, there are subtle differences in request paramters that Rails received between LiteSpeed LSAPI and webrick.
Run the app under Litespeed and dump the URL.
 

mistwang

LiteSpeed Staff
#4
"Dump the URL" means that write the URL to the log file or somewhere.
I need to get an idea about how the URL looks like, and it will be even better if you can log the whole redirect response sent back to LSWS by Rails.
 

djsodom

Active Member
#5
Thanks George. I will work on this and get you some info. I put it aside for awhile to work on something else.


"Dump the URL" means that write the URL to the log file or somewhere.
I need to get an idea about how the URL looks like, and it will be even better if you can log the whole redirect response sent back to LSWS by Rails.
 

djsodom

Active Member
#6
Okay, I used livehttpheaders to dump the URLs using both Litespeed and Lighttpd for contrast.

I've attached both text files it generated (though I deleted some of the calls to my stylesheets for example for brevity).

What I'm doing is basically an ajax quiz.

A question is presented. the user clicks on a question, which posts the data to the db, and is then redirected to another question that renders as a partial replacing the html of the previous question.
---------------
i can't seem to get the text files to actually attach to this message, so I'll just post the text here:

Lightspeed
Code:
http://localhost:82/quizzes/presidents;list

GET /quizzes/presidents;list HTTP/1.1
Host: localhost:82
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: application/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
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: _session_id=3d0d46d90b342fa7f560653feb949abf
Cache-Control: max-age=0

HTTP/1.x 200 OK
Content-Type: text/html
Set-Cookie: _session_id=3d0d46d90b342fa7f560653feb949abf; path=/
Cache-Control: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
Server: LiteSpeed
Date: Fri, 15 Sep 2006 11:58:59 GMT
----------------------------------------------------------
http://localhost:82/quizzes/index/presidents?tid=8&curator_id=4

POST /quizzes/index/presidents?tid=8&curator_id=4 HTTP/1.1
Host: localhost:82
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: text/javascript, text/html, application/xml, text/xml, */*
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: close
X-Requested-With: XMLHttpRequest
X-Prototype-Version: 1.5.0_pre0
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
Cookie: _session_id=3d0d46d90b342fa7f560653feb949abf
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.x 302 Found
Content-Type: text/html
Set-Cookie: _session_id=3d0d46d90b342fa7f560653feb949abf; path=/
Cache-Control: no-cache
Location: http://localhost:82/quizzes/12
Content-Encoding: gzip
Vary: Accept-Encoding
Transfer-Encoding: chunked
Server: LiteSpeed
Date: Fri, 15 Sep 2006 12:00:16 GMT
Connection: close
----------------------------------------------------------
http://localhost:82/quizzes/12

GET /quizzes/12 HTTP/1.1
Host: localhost:82
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: application/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
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: _session_id=3d0d46d90b342fa7f560653feb949abf
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.x 200 OK
----------------------------------------------------------
http://mozilla.ziply.com//firefox/releases/1.5.0.7/update/mac/en-US/firefox-1.5.0.7.complete.mar

GET //firefox/releases/1.5.0.7/update/mac/en-US/firefox-1.5.0.7.complete.mar HTTP/1.1
Host: mozilla.ziply.com
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: application/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
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
Range: bytes=2555904-2621439

HTTP/1.x 206 Partial Content
Date: Fri, 15 Sep 2006 12:00:57 GMT
Server: Apache/1.3.35 (Unix) mod_perl/1.29 PHP/5.1.4
Last-Modified: Thu, 14 Sep 2006 06:57:40 GMT
Etag: "15b2811-e7cd72-4508fd64"
Accept-Ranges: bytes
Content-Length: 65536
Content-Range: bytes 2555904-2621439/15191410
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/plain
----------------------------------------------------------
Lighttpd
Code:
 http://localhost:3000/quizzes/presidents;list

GET /quizzes/presidents;list HTTP/1.1
Host: localhost:3000
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: application/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
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: _session_id=3d0d46d90b342fa7f560653feb949abf

HTTP/1.x 200 OK
Transfer-Encoding: chunked
Content-Type: text/html
Set-Cookie: _session_id=3d0d46d90b342fa7f560653feb949abf; path=/
Cache-Control: no-cache
Date: Fri, 15 Sep 2006 12:06:34 GMT
Server: lighttpd/1.4.11
----------------------------------------------------------
----------------------------------------------------------
http://localhost:3000/quizzes/index/presidents?tid=8&curator_id=4

POST /quizzes/index/presidents?tid=8&curator_id=4 HTTP/1.1
Host: localhost:3000
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: text/javascript, text/html, application/xml, text/xml, */*
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: close
X-Requested-With: XMLHttpRequest
X-Prototype-Version: 1.5.0_pre0
Content-Type: application/x-www-form-urlencoded
Content-Length: 0
Cookie: _session_id=3d0d46d90b342fa7f560653feb949abf
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.x 302 Found
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
Set-Cookie: _session_id=3d0d46d90b342fa7f560653feb949abf; path=/
Cache-Control: no-cache
Location: http://localhost:3000/quizzes/12
Date: Fri, 15 Sep 2006 12:06:38 GMT
Server: lighttpd/1.4.11
----------------------------------------------------------
http://localhost:3000/quizzes/12

GET /quizzes/12 HTTP/1.1
Host: localhost:3000
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Accept: application/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flashapplication/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
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: _session_id=3d0d46d90b342fa7f560653feb949abf
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.x 200 OK
Transfer-Encoding: chunked
Content-Type: text/javascript
Set-Cookie: _session_id=3d0d46d90b342fa7f560653feb949abf; path=/
Cache-Control: no-cache
Date: Fri, 15 Sep 2006 12:06:38 GMT
Server: lighttpd/1.4.11
----------------------------------------------------------
 

mistwang

LiteSpeed Staff
#7
The log shows that the request for "/quizzes/12" failed when LSWS is used. Only get "200 OK ..." line, other header lines are missing.

You can try this request directly, without redirection, redirection is working fine.

Take a look at how this request being handled by rails, and anything special makes LSWS fail then I can fix it.

You can use comnand "lynx -mime_header http://localhost:82/quizzes/12" to dump the whole response, wget can do it as well, I forgot the command line parameter.
 
Top