REST, LiteSpeed & Attachment_fu
August 03, 2007 @ 12:42 PM | posted by carmelyne
(last updated: 08.09.07)The big picture is with the redirects.
The quick work around...
If you've read my post about FreeImage, then you might be interested to know about the conflict I encountered with a RESTful app on LiteSpeed and using attachment_fu.
This was quite perplexing to be honest. I installed attachment_fu on a restful app, tested on my dev environment which is using Mongrel. I committed to my svn, updated files served on LiteSpeed and uh oh, the upload feature wont work. There's no error message, nothing gets saved at all and returns back as a 200 code. I couldn't debug alas I'm not the all perfect coder either. /wink /wink. I resorted to finding a work around.
First let's get some things clear, the conflict with REST, LiteSpeed and Attachment_fu is on another slice but not on this blog's slice. When I was looking for a work-around the first thing I did was to test the attachment_fu on this blog done by Rick Olson. Justin Palmer did the UI which is great. First, it wouldn't work since I had to give proper permissions to the assigned public image folder. Then everything after that was fine and dandy. Why does it work on here and not on the other slice. I go deep into the code reading line by line but time is running short. I need the upload feature working like yesterday.
For a quick fix, I thought to myself that I will just get LiteSpeed to work with Mongrel for the time being till I get a fix. I visited PickledOnion's excellent blog because he has the LiteSpeed set up goodies. I couldn't find any about Mongrel. That's fine since you really don't need Mongrel if you've chosen LiteSpeed. I emailed Paul aka PickledOnion and told him about my scenario. He said he was looking to getting attachment_fu to work on his project so he'll let me know if he ran into any issues. Us slicers have that special slicer bond. I don't know what that means but OK. ;p
I'm very happy with using LiteSpeed. The free version is good for a simple less traversed site like this blog of mine. Now having said all that, back to the workaround. I went now to the LiteSpeed and Mongrel sites to find some docs on how to set it up. Unfortunately, no docs on LiteSpeed with Mongrel at the LiteSpeed site but there was a short version on the Mongrel site. The one on the Mongrel site is a bit too complex, I can write down my fewer steps for a next blog post. After that, the work around was great. The upload function works under LiteSpeed, Mongrel using attachment_fu.
It continues....
It doesnt stop there. A few nights ago, just one of those long coding nights, I get an email back from Paul saying he has encountered the same issues I was having with LiteSpeed. He's heavy into the detailed configurations and was able to figure out some fixes. He's posted a ticket on the LiteSpeed forums to look into the issue. It looks like the LSapi version has issues with the restful redirects. The LiteSpeed support team is now looking into this so we'll see but for now, I'll be trying Paul's fix. The ticket is right here. It has the fix Paul suggested. I hope they patch it.
Update: (Aug. 5, 2007)
The LiteSpeed Team has updated the LSapi version to perform redirection more intelligently and to do redirect if there is an index file under that directory, otherwise, return it as a 404; that way the URI will be kept when handled by rails dispatcher. The thread
I've tested the LiteSpeed Enterprise version and all works perfectly. Restful Rails app with Attachement_fu on LiteSpeed is a happy little working wonder now.
Unrelated Windows Issue: (Aug. 7, 2007)
If you found this post while looking for a windows solution to error: 'Size is not in the list', I recommend adding the :size option on the model. Starting from 0.kilobytes to your max upload limit as sampled below.
1 2 |
has_attachment :content_type => :image, :size => 0.kilobytes..500.kilobytes |
[ Last updated: August 09, 2007 @ 05:46 PM ]
3 Responses to...
“REST, LiteSpeed & Attachment_fu”
Sorry, comments are closed for this article.




Carmelyne,
Nice post. It outlines exactly what the concern is and what is happening. I must admit I was a bit taken aback by this Litespeed issue as it's the first I've encountered.
However, I have been pleased with the response from the email and sample application I sent to Litespeed bugs, although no solution has been offered yet.
It will be interesting to see how long it takes as I regard this as a huge issue and I only use (well try to anyway) RESTful Rails design.
Paul/PickledOnion.
Posted: August 3rd, 2007 at 02:35 PM
Thanks, Paul. Let's hope a fix.
Posted: August 3rd, 2007 at 10:21 PM
I see it has know been fixed in 3.2.1. Thanks Carmelyne and Paul, you saved me a headache.
Posted: August 6th, 2007 at 12:50 AM