I have the following configuration in my session_store.rb
Fuel::Application.config.session_store :cookie_store, :key => "_secure_session", :secure => !(Rails.env.development? || Rails.env.test?), :domain => :all
In application_controller.rb
def default_url_options return { :only_path => false, :port => 443, :protocol => 'https' } end
I am using devise and my rails3 server is running behind HAProxy. HAProxy terminates HTTPS traffic and sends HTTP Rails requests. My problem is when I enable: secure => true in session_store.rb, the user is redirected back to the login page with the message "Unauthorized". I tried debugging it a lot, not sure how to make it work.
This is a situation where HAProxy is a reverse proxy server that terminates all protected traffic and sends unprotected traffic to the rails. When the rails set a cookie for protection, somehow he himself cannot access it.
source share