Rails send_file not working with litespeed

Discussion in 'Ruby/Rails' started by bsharpe, Mar 8, 2008.

  1. bsharpe

    bsharpe New Member


    I've setup litespeed on os X 10.5 and on Solaris 10 (Joyent) and i'm finding that my code that worked find for apache and nginx does not work for litespeed and I'd like to know if there's a workaround.

    We do a lot of on-the-fly image creation and we typically create the image in a tempfile and then send that to the webserver that caches it for retrieval later.

    tempfile.new do |tfile|
    path = tfile.path
    #create image in path

    send_file path, :type => 'image/png', :disposition => 'inline'
    # the tempfile is unlinked at the close of the block above

    As I said, this works fine with nginx+mongrel or apache+mongrel, but not under litespeed+lsapi

    Thanks for your help.
  2. bsharpe

    bsharpe New Member

    Just a little more information:

    - This does work on OS X. It does not work on Solaris 10 (Joyent server)

    - On Joyent, i'm using the 4-cpu leased license 3.3.7
  3. mistwang

    mistwang LiteSpeed Staff

  4. sderrick

    sderrick Member

  5. sderrick

    sderrick Member

    I figured it out. Simpler than I though...

    def sendfile
    @name = session[:jobname] + ".zip"

    filename = "public/download/" + @name
    headers["Location"] = filename


    Is this forum actually monitored by Litespeed? I hope I haven't chosen a product that isn't supported.

  6. mistwang

    mistwang LiteSpeed Staff

    Yes, it is monitored. :)
    The reason for lacking response to your post is that we are not ruby/rails developer, we can only provide generic information about this feature, which we already did.
    You are welcome to update the wiki to include your RoR code sample. :)
  7. sderrick

    sderrick Member

    Thanks for the quick reply.. And thanks for the awesome webserver...

    I'll update that Wiki right now...


Share This Page