Skip to content

Get/set/destroy session based on request details #711

Closed
@boenrobot

Description

@boenrobot

I have an application that serves multiple domains ("Host" header values). Requests for each domain go to a different database, but it's still the same logic for all. I also want to store sessions for each domain in its respective database.

The current architecture of session stores doesn't allow that though. Everything about any store is set prior to requests, so one can't get/save/destroy based on the request.

This could change by adding the request as an additional argument to all required and reccomended methods, allowing stores to potentially accept config per request, and keep their existing behaviour when such a config is not supplied.

I realize this may be a breaking change for some stores (and for the rest, there wouldn't be immediate benefit, until they take advantage of it), so if implemented, a major version bump would probably be in order.

EDIT: I have an implementation at #712 that is backwards compatible with existing stores. It relies on checking the expected number of arguments in the handling function. A tactic used by some other libraries for similar purposes (notably, passport).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions