Added auto sub domain feature for cookies#311
Open
rbjarnason wants to merge 6 commits intoexpressjs:masterfrom
Open
Added auto sub domain feature for cookies#311rbjarnason wants to merge 6 commits intoexpressjs:masterfrom
rbjarnason wants to merge 6 commits intoexpressjs:masterfrom
Conversation
| "uid-safe": "~2.1.0", | ||
| "utils-merge": "1.0.0" | ||
| "utils-merge": "1.0.0", | ||
| "parse-domain": "^0.2.1" |
Contributor
There was a problem hiding this comment.
Please use an exact version and order this to be alphabetical (otherwise npm operations will reorganize it, creating unnecessary churn).
| , Cookie = require('./session/cookie') | ||
| , Store = require('./session/store') | ||
|
|
||
| var parseDomain = require('parse-domain'); |
Contributor
There was a problem hiding this comment.
If you can, please move this up with the other requires (probably right before the parseUrl one).
Contributor
|
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. |
paulfitz
added a commit
to paulfitz/session
that referenced
this pull request
Apr 22, 2020
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
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.