Note that there are some explanatory texts on larger screens.

plurals
  1. PORails - 401 Unauthorized when I access action in Production only
    primarykey
    data
    text
    <p>I'm using Ruby On Rails 3.0.9 and everything works fine on Development env. When I switch to Production env, or I upload it to our server, after sign in I'm taken back to the same Login page. When I check the log, I can see the following:</p> <pre><code>Started POST "/users/login" for 127.0.0.1 at Thu Oct 03 16:48:13 -0300 2013 Processing by UserSessionsController#create as HTML Parameters: {"user"=&gt;{"password"=&gt;"[FILTERED]", "login"=&gt;"demo_admin"}, "utf8"=&gt;"✓", "authenticity_token"=&gt;"+7AEoVXZ9XiagEymVUnOhFHnck4rgDu883E/ySMlCxQ="} Redirected to http://localhost:3000/admin Completed 302 Found in 111ms Started GET "/admin" for 127.0.0.1 at Thu Oct 03 16:48:13 -0300 2013 Processing by Admin::DashboardController#index as HTML Completed 401 Unauthorized in 1ms </code></pre> <p>I'm using authorization_rules file in order to manage access, but I've got no problem on Dev env, as I said before.</p> <p>If I place a breakpoint at the <code>admin/dashboard#index</code> action, it won't be executed, as it's not reached. It breaks at httpserver file (I debugged it step by step), but I cannot understand why it works on Dev and not on Prod env.</p> <p>Please, help.</p> <p>Thanks, Brian</p> <p><strong>UPDATE</strong></p> <p>I forgor to mention that, in my <code>ApplicationController</code>, there's a before_filter called <code>check_plan_features</code> and the first thing it asks is <code>unless current_user.blank? #redirects to Admin section</code>.</p> <p>I've noticed that after signing in, using Devise, <code>current_user</code> has the user's value, but when after redirecting to the admin section, it comes back to the same filter, and this time, the <code>current_user</code> is null. <strong>So, I assume that, somehow, the user's session is destroyed after trying to access Admin section. But, as this only happens on production environment, I'm still wondering what could be.</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload