Uploadify authentication problem

I'm trying to use Uploadify in my project. Everything works in my machine, locally. The problem is when I use the same code in my production environment. When I try to upload a photo, it returns an error "HTTP 401", but there are no errors in the log.

Rails(2.3.5) Uploadify(2.1.0)

Here is my FlashSessionCookieMiddleware where the problem with the Flash authentication shoud be solved.