ForbesLindesay
ForbesLindesay

Reputation: 10702

Does connect.session work with node-azure

I'm starting to develop an application using node.js on azure. I'm using everyauth to provide authentication because I want to support lots of different authentication methods. I plan to deploy to Azure. The potential problem I have is that everyauth requires the connect.session helper. Will this work with azure when running multiple instances? Or do I need an alternative session provider?

Upvotes: 3

Views: 440

Answers (2)

Yavor Georgiev
Yavor Georgiev

Reputation: 654

This was asked a while ago, but I thought I would attempt an answer anyway. It seems that connect-session relies on cookies to maintain the session. Azure has a different load-balancing strategy depending on what you use:

  • WebRole/WorkerRole - the LB doesn't have any affinity so requests from your clients might end up at different backend instances. This will throw off whatever session management connect is doing. This is a side effect of a distributed cloud architecture: you don't want any backend node to be the source of truth since it can go down. So what you would have to do is figure out how to externalize connect's cookie store and have all backends share it. This way no matter what backend receives the request, it will be aware of the session.

  • Websites - in this case the LB will actually try to pin a client connection to a given backend instance, so cookie-based sessions may work without any changes. You are sacrificing failover, as described above.

Upvotes: 0

Treffynnon
Treffynnon

Reputation: 21553

I have never used Node.js on Azure, but:

everyauth

Looking at the documentation for everyauth there is a method for authenticating against a Windows Azure ACS. See the section entitled Setting up Windows Azure Access Control Service (ACS) Auth in the readme for more information. There are no notes there about it not working on Azure itself so I would infer from that that you can use it on Azure.

connect-azure

There is also a project called connect-azure, which appears to be using connect.session so again I would extrapolate from this that it will work on Azure.

Contact Azure support

If you are already a customer you can contact support for help.

Try it and see

So if you have the Azure environment setup I would definitely say it is worth trying it out.

Upvotes: 1

Related Questions