设置响应Cookie在ec2上不起作用,但在localhost上起作用

时间:2018-10-28 14:39:53

标签: ruby-on-rails ruby cookies ruby-on-rails-5

我通过此行代码设置响应Cookie

 module Users
  class SessionsController < Devise::SessionsController
    skip_before_action :authenticate_user
    skip_before_action :verify_authenticity_token
    skip_before_action :verify_signed_out_user # Skip this action from super class

    .....
    def handle_login(response)
      ApplicationRecord.transaction do
        // Verify user 
        // Issues new token
        auth_token = issue_auth_token user

        # Delete current user auth token and create new one
        session.delete(:current_authentication_token)
        session[:current_authentication_token] = auth_token.authentication_token
        cookies[:current_authentication_token] = {:value => auth_token.authentication_token, :expires => 1.month.from_now, :domain => :all}
        redirect_to users_homes_path
      end
    end
 end

它在localhost上运行良好,但是当我将项目部署到ec2时,键为current_authentication_token的cookie没有保存。

0 个答案:

没有答案