To configure Azure App Gateway to automatically move sessions, the cookie-based session affinity feature is useful to keep a user session on the same server
when application gateway instance is provisioned, it automaticallyconfigures a default health probe to each BackendAddressPool using properties of the BackendHttpSetting.
If the user is hitting on application gateway, now the application gateway has redirected to session it got connected to the one node if something disconnected, restart, or unhealthy if user again try to connect, cookie-based affinity is enable user will connect to the same target unhealthy Probe retry count. The back-end server is marked down after the consecutive probe failure count reaches the unhealthy threshold.
If cookie-based affinity is not Enable application gateway automatically to redirect into another node or it also redirect to the same node there is no guarantee that it will connect to the same backend target in this case, it can connect to the other node also.
To check whether the "Cookie-based Affinity” setting is enabled
Go to Azure portal -> in left side click All resources -> select App Gateway name in the All-resources blade -> Setting -> HTTP setting -> Add HTTP -> Cookie-based Affinity ->Disable
![enter image description here]()
For more information in detail, please refer below links:
Troubleshoot Azure Application Gateway session affinity issues
Sticky and NON-Sticky sessions
https://docs.microsoft.com/en-us/azure/application-gateway/configuration-overview
https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-troubleshooting-502#problems-with-default-health-probe