I have a Chicken and Egg problem.
I am using a Node.js HTTPServer to route web requests to different Node.js workers, depending on their Connect.SID cookie that is sent in the request headers.
Each of my Node.js workers use Connect / Express and assign Connect.SID cookies when a request connects for the first time.
Problem
Apparently, if the request has a Connect.SID that is not registered with that instance of Node, Connect assigns a new ID.
So, I have a new Connect.SID. My HTTP Proxy logs ID 12345 and routes it to worker #5. Worker #5 sends back new ID 56344 to the browser. Next browser request - HTTP Proxy sees a brand new ID - 56344 - logs it and sends to Worker #6. Worker #6 sees new SID and....
The Connect Session middleware is too... simple...
app.use(express.cookieParser());
app.use(express.session({ secret: "niceTry", cookie: { /* ... */ } }));
Is there a way to inject logic into its assignment of a new Session ID so it skips it if there is already an unregistered, but valid, Connect.SID?