Can't login with development in production with rails 4

I have a perfect solution for my localhost. As soon as I push it to the server and install to production (apache / passanger) I cannot login. I can login but using the production webrick on the server.

If I give a wrong password, I get a wrong password error. When I use the correct password, I am redirected to the login redirect page, but I am not logged in.

I'm using active recording sessions, not sure if this has anything to do with the problem.

Login is successful as I see in the logs where the current user stats are updated after login, but then when the new page loads user_signed_in? returns false.

Here is the query I see in the logs for reference:

SQL (0.3ms)  UPDATE "users" SET "current_sign_in_at" = $1, "last_sign_in_at" = $2, "sign_in_count" = $3, "updated_at" = $4 WHERE "users"."id" = 1  [["current_sign_in_at", "2015-01-03 19:34:11.930934"], ["last_sign_in_at", "2015-01-03 19:29:33.496977"], ["sign_in_count", 18], ["updated_at", "2015-01-03 19:34:11.931889"]]

      

Update: I came across this possible solution that worked for others: Set config.http_authenticatable = false

in your config / initializers / devise.rb. to prevent HTTP Auth from interfering from Apache. This did not fix the problem for me.

Update 2 . I read somewhere that it might be caused by an Apache configuration issue and someone else was able to fix it by switching to nginx. I was fine as webrick works fine even in production mode. I made a switch and still have the same problem.

Any help would be greatly appreciated. I will continue my research as well.

+3


source to share


1 answer


Here's what fixed it for me:

I was running ruby-2.0.0-p195 and I updated to ruby-2.2.0



Not sure why it worked, but it did. Hope this helps someone else. Also, if you have a similar problem, have a look at the troubleshooting steps I did in the updates. Maybe this will help you too.

0


source







All Articles