a demo showing how to share sessions between NodeJS and PHP
PHP: Click here
NodeJS: Click here
- PHP starts a session, generates a PHPSESSID
- write PHPSESSID into cookies["shared_session_id"] and write session <-> user into Redis
- NodeJS reads cookies["shared_session_id"]
- Recover user_id from Redis
Key notes:
- Cookies MUST be in the root domain (
beng.io
in this case) so they can be read by all subdomains (a.beng.io
andb.beng.io
)