The simple_captcha works find on my dev machine but it doesn't on 开发者_JAVA技巧my shared hosting server(Dreamhost).
ImageMagick is installed and RMagick is ok there. What could be wrong?
I checked the log and it doesn't show any error message.
Started GET "/simple_captcha/0245065ca02e2f4fadc22b3f08e1357ea74221f8?time=1304535698" for 99.122.173.225 at Wed May 04 12:01:38 -0700 2011
When I type 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
Have you tried commenting out the
config.action_dispatch.x_sendfile_header = "X-Sendfile"
line?
Found here: Rails sends 0 byte files using send_file
I had the same problem in a server running Ubuntu 10.10 + Nginx + Passenger.
I found the 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. So you need to enable XSendfile in your production environment. You can do that putting this line in your environments/production.rb:
config.action_dispatch.x_sendfile_header = "X-Sendfile"
In case you're using nginx, you have to use X-Accel-Redirect instead. See http://wiki.nginx.org/XSendfile
config.action_dispatch.x_sendfile_header = "X-Accel-Redirect"
精彩评论