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

  • Home
  • SEARCH
  • 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 608143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:25:57+00:00 2026-05-13T17:25:57+00:00

Is it possible to set the cookie domain to something other than the current

  • 0

Is it possible to set the cookie domain to something other than the current domain when a session is created with Authlogic?

When a new account is created from our signup domain, I’d like to redirect the user to their subdomain account and log the user in.

Current controller:

def create
  @account = Account.new(params[:account])
  if @account.save
    @user_session = @account.user_sessions.create(@account.users.first)
    # I'd like the cookie domain to be [@account.subdomain, APP_CONFIG[:domain]].join(".")
    redirect_to admin_root_url(:host => [@account.subdomain, APP_CONFIG[:domain]].join("."))
  else
    render 'new'
  end
end
  • 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-13T17:25:57+00:00Added an answer on May 13, 2026 at 5:25 pm

    If you do:

    config.action_controller.session[:domain] = '.YOURDOMAIN.COM'

    in your production.rb file, that will allow you to have everyone logged in on all subdomains of your subdomain. If you then add a filter (or whatever, but I use a filter so I know that works) that checks that someone is actually using the right domain before you show controller stuff, it works pretty well.

    As an example, you could store the appropriate subdomain for the session as a session variable and give people link options to their specific things if they were on your main domain or looking at a page on someone else’s subdomain.

    This seems to be the general pattern for doing this sort of thing — if you set a cookie specific to the subdomain otherwise you won’t be able to tell when they’ve logged in to the main site. I also have a ‘users_domain?‘ helper that ends up getting called occasionally in views when I do this.

    If you don’t want to have those sorts of common web design patterns, wesgarrion’s single use -> session creation on subdomain is also a way to go. I just thought I’d mention this as a design / interaction / code issue.

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

Sidebar

Related Questions

No related questions found

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.