X-LiteSpeed-Location strange behaviour with Rails

Discussion in 'Bug Reports' started by andreas, Oct 28, 2007.

  1. andreas

    andreas New Member

    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
  2. mistwang

    mistwang LiteSpeed Staff

    How about adding

    headers['status']="200 OK"
  3. andreas

    andreas New Member

    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.
  4. mistwang

    mistwang LiteSpeed Staff

    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.

Share This Page