buddy
buddy

Reputation: 197

Dragonfly not working in production

I am using Dragonfly with Nginx, unicorn and mini_magick. I am using mem_cache_store in production.

Image upload and display works fine in development environment. But on production it fails with internal server error 500. I cannot see any logs on my production log, but it fails on production.

I get error for URLs of following type. http://cdn.mydomain.com/media/BAhbB1sHOgZmSSIoMTAvcHJvZHVjdHMvMjUvR3JvdW5kJTIwbnV0XzQwOS5qcGcGOgZFVFsIOgZwOgp0aHVtYkkiCjUweDUwBjsGVA.jpg

Error code is 500

I ve been searching all the documentation which comes along with the gem. I can see the following middleware on top of the middleware stack in production as well:

use Rack::Cache
use Dragonfly::CookieMonster
use Dragonfly::Middleware

I could not get much help from forums - though there is a similar bug posted 2 years ago and is supposed to be fixed. And fixes there also did not help.

Please help to fix this. Any direction as to how I can debug this would also help.

Upvotes: 0

Views: 812

Answers (2)

I ran into an issue like this and turned out that the problem was that I didnt have imagemagick installed in production. This post helped me Dragonfly - Uploaded images not displayed

Btw I wasnt seeing any logs too.

Upvotes: 1

Mauricio Idarraga
Mauricio Idarraga

Reputation: 1

You need to add:

Config.middleware.insert 0, Rack::Sendfile, config.action_dispatch.x_sendfile_header

so that sendfile is before rack:cache and it should work.

Upvotes: 0

Related Questions