-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multi-subdomain session by setting cookie host in ses…
…sion cookie so you can share session between www.example.com, example.com and user.example.com. [#4818 state:resolved] Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
- Loading branch information
Showing
4 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c4d6245
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work for .co.uk?
c4d6245
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to not work for ".co.uk" domains. I didn't actually run the test suite against it but just running the code through my head:
So the final result is ".co.uk" which is an invalid cookie domain. I don't think there is any clean way to implement this without a blacklist sort of approach (this is how Firefox & Opera validate cookie domains, for example), so I'd recommend we just stick with the manual
:domain => ".mydomain.com"
approach, which isn't too difficult.c4d6245
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in the lighthouse ticket, this is the simplest aproach, and for 3th level domains, you need to continue using the old approach.
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4818-share-session-between-subdomains#ticket-4818-3
c4d6245
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. I'm okay with that since all my domains are in the ".com" or other single TLD domain. I guess it just concerns me that ":domain => :all" is misleading then for "co.uk" and other users.