LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > X-LiteSpeed-Location strange behaviour with Rails

Reply
 
Thread Tools Display Modes
  #1  
Old 10-28-2007, 03:21 AM
andreas andreas is offline
Senior Member
 
Join Date: Aug 2006
Posts: 91
Default X-LiteSpeed-Location strange behaviour with Rails

Hi,

I'm using X-LiteSpeed-Location to serve static files from a Rails app and noticed some strange behaviour:

This works:
Code:
        render_text ''
        headers['X-LiteSpeed-Location'] = "/myfile}"
This returns the correct file, but with status 404:
Code:
        render_text ''
        headers['X-LiteSpeed-Location'] = "/myfile}"
        headers.delete 'Status'
This returns the location header to the client, but with Status 404:
Code:
        render_text ''
        headers['Location'] = "/myfile}"
        headers.delete 'Status'
Andreas
Reply With Quote
  #2  
Old 10-28-2007, 09:22 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
How about adding

headers['status']="200 OK"
Reply With Quote
  #3  
Old 10-29-2007, 04:23 PM
andreas andreas is offline
Senior Member
 
Join Date: Aug 2006
Posts: 91
According to the documentation the backend must not send a status header if it wants to do an internal redirect. If I leave the default status that is set by render_text (=200) the "Location"-Header gets sent to the client.
Reply With Quote
  #4  
Old 10-30-2007, 01:44 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Set status code to 200 with "X-LiteSpeed-Location" should work.
Rails may change the status code to 3xx when "location" header was set, that will result in "Location" header being sent.

The 404 status code is because that 404 handler was used for Rails application, you can use rewrite rule to dispatch the request to Rails app handler. We will force the status code to 200 for 'X-LiteSpeed-Location' in 3.3 release.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:08 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.