Score:0

Azure application gateway causes sessions to dissapear

in flag

We've got a setup of:

  • Linux container web app (single instance)
  • Nodejs server with passportjs + openid
  • External Authentication (OpenID) provider.

If the frontend is contacted directly (through .azurewebsites.net) the authentication works as expected and sessions are working.

Then we've configured a new domain, which points to application gateway and gets redirected to the webapp. Now the UI itself loads, however, after the login, the application "forgets" that the user is logged in.

Looking at the response cookies the appSession cookies disappear right after the first login redirect.

What can be done to fix this problem? I've seen that cookie based affinity can be enabled, but to my understand that would make sense if I have multiple instances of the UI ?

Score:0
br flag

The most probable cause is that you must enable the Cookie based affinity

  1. Log on to the Azure portal.
  2. In the left navigation pane, click All resources. Click the application gateway name in the All resources blade. If the subscription that you selected already has several resources in it, you can enter the application gateway name in the Filter by name… box to easily access the application gateway.
  3. Select HTTP settings tab under SETTINGS.
  4. Select the HTTP setting, and on the Add HTTP setting page, check if Cookie based affinity is enabled. enter image description here

More Troubleshoot Azure Application Gateway session affinity issues

Hope this helps!

vn flag
This shouldn't matter if OP has a "single instance", should it?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.