Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 583395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:47:18+00:00 2026-05-13T14:47:18+00:00

Context : A rails app with authlogic for sigup and login Setup info: Rails

  • 0

Context: A rails app with authlogic for sigup and login
Setup info: Rails 2.3.2

A controller called posts with an action ‘show’.
Upon login, I display the posts/index page.

and when the user clicks on an item, item’s details get displayed. Fairly standard stuff.

All of this works fine and dandy both in Development and Production (Apache with Passenger 2.2.5 on ubuntu and mysql) EXCEPT for the following problem in one case:

Problem:
ONLY on Firefox/Safari/Chrome (IE7 is Ok) and ONLY in PRODUCTION,

When the user logs in for the very FIRST time in a new session
(open new browser,type in url), the index page is displayed fine
and when an item is clicked, the user gets mysteriously LOGGED OUT
(current_user returns null).

When you login again, everything is BACK to normal – you can logout and login any number of times and no problem – UNTIL you close the browser and start again.

Any other action besides ‘show’ has the current_user preserved and works fine.

QUESTION:
How is the user session getting lost on a call like this
posts/id only once – the first time ?
The show action doesn’t do anything special.

I have used both ActiveRecord Store and Cookies for Session Management with same behavior.

Anybody got any clues, greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:47:18+00:00Added an answer on May 13, 2026 at 2:47 pm

    This might be happening because the user is getting redirected from:
    http://yoursite.com to http://www.yoursite.com

    Here’s a blog that mentions this problem:
    http://garrickvanburen.com/archive/rails-cookie-settings-for-cross-subdomain-sessions

    To paraphrase the blog:
    The fix is to set:
    config.action_controller.session[:domain] = '.YOURDOMAIN.COM'
    inside of environment.rb (Make sure to prefix it with the .). That will make cookies work for both http://www.yourdomain.com and yourdomain.com (as well as any other subdomains).

    This technique is also discussed here:
    Losing session in rails 2.3.2 app using subdomain

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am planning on using declarative authorization in a Rails 3 app. I have the
For my rails app, I use a fixed layout with 2 columns (a main
I'm working on a ruby on rails app that generates a large XML document
I'm using Paperclip 2.3.5 within a Rails app to store PDF documents on Amazon
This is a bit complicated but here goes. I have a Rails app that
I've upgraded my app from using config.gem to a Gemfile with bundler and have
I'm trying to upload to a portfolio app I've built, specifically trying to find
SO this is a bit of an odd request but hoping someone on here
I've been searching all over for tips on this and have not really had
I am probably missing soemthing very simple, but the following is a comment posted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.