In my application, rails 3 simple_captcha does not display the image in production mode

A simple_captcha search finds dev on my machine, but it is not on my hosting server (Dreamhost).

ImageMagick is installed, and RMagick is fine there. What could be wrong?

I checked the log and did not find any error messages.

Started GET "/simple_captcha/0245065ca02e2f4fadc22b3f08e1357ea74221f8?time=1304535698" for 99.122.173.225 at Wed May 04 12:01:38 -0700 2011 

When I type in the address (/ simple_captcha / 0245065ca02e2f4fadc22b3f08e1357ea74221f8? Time = 1304535698), it says that "the image cannot be displayed because it contains errors."

Any idea what's wrong?

Thanks.

Sam

+7
source share
2 answers

Have you tried commenting out the line config.action_dispatch.x_sendfile_header = "X-Sendfile"?

Found here: Rails sends 0 byte files using send_file

+6
source

I had the same problem on a Ubuntu 10.10 + Nginx + Passenger server.

I found a solution in this thread: http://www.mail-archive.com/ heroku@googlegroups.com /msg06836.html

simple_captcha uses send_file to send the image to the browser. Therefore, you need to enable XSendfile in your production environment. You can do this by putting this line in /production.rb:

 config.action_dispatch.x_sendfile_header = "X-Sendfile" 

If you are using nginx, you should use X-Accel-Redirect instead. See http://wiki.nginx.org/XSendfile

 config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" 
+3
source

All Articles