How to setup session affinity for Rest API in Azure App Service

819 Views Asked by At

I have a frontend app service (scaled up to 3 nodes) and a api app service (scaled up to 3 nodes) on Azure. When user enter the website, the request goes to frontend app service first and then retrieve other information from api app service by rest call. How can I setup the session affinity in Azure to ensure the rest api requests go to the same server node?

I have disabled the cookie based affinity for frontend app service and enabled it for api app service in Azure application gateway. I can see the ARRAffinity cookie is set from browser DevTool. But the ARRAffinity cookie in response header of subsequent api calls are not the same. The ARRAffinity is changing.

1

There are 1 best solutions below

0
Narthring On

Make sure you have "ARR Affinity" set to "on" in the app service configuration: enter image description here If you have done that and still see the issue I would suspect a configuration issue with the Application Gateway. If you provide some screenshots of the App Gateway configuration we might be able to provide more assistance. Additionally if you're using Front Door, CloudFlare, or anything else that's in between the browser and the API please let us know. Proxies and other resources can intercept those ARRAffinity cookies and create additional issues.