-
-
Notifications
You must be signed in to change notification settings - Fork 987
Added auto sub domain feature for cookies #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -18,7 +18,8 @@ | |||
"on-headers": "~1.0.1", | |||
"parseurl": "~1.3.1", | |||
"uid-safe": "~2.1.0", | |||
"utils-merge": "1.0.0" | |||
"utils-merge": "1.0.0", | |||
"parse-domain": "^0.2.1" |
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.
Please use an exact version and order this to be alphabetical (otherwise npm
operations will reorganize it, creating unnecessary churn).
@@ -27,6 +27,7 @@ var Session = require('./session/session') | |||
, Cookie = require('./session/cookie') | |||
, Store = require('./session/store') | |||
|
|||
var parseDomain = require('parse-domain'); |
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.
If you can, please move this up with the other requires (probably right before the parseUrl
one).
Thanks for the pull request! On top of the comments I made inline, you also need to add documentation to the README for this feature as well as add unit tests that cover all new branches in code you've created here. |
This adds a `getDomainFromRequest` option which allows `cookie.domain` to be computed from the request rather than set as a constant. As an example of when this is useful, imagine serving a single app from `*.foo.com` and `*.bar.com`, with domain being `.foo.com` for the `*.foo.com` domains and `.bar.com` for the `*.bar.com` domains. This may be related to expressjs#311
9d2e29b
to
408229e
Compare
We run one node.js server that serves multiple domains and we wanted to have the cookies shared across subdomains. The usual way to do this is to set domain: '.domain.com' in the options but this is not possible as we are serving multiple domains hence this simple addition.