Skip to content

Commit 696a26b

Browse files
committed
Clarify session on file system or database
1 parent 674efbb commit 696a26b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ Here we will describe how to deploy it to
3737
* Follow the ["Quickstart: Deploy a Python (Django or Flask) web app to Azure App Service"](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python),
3838
but replace its sample app (which does not do user sign-in) with this web app.
3939

40-
* In particular, if you choose to ["deploy using Local Git" in "step 3 - Deploy your application code to Azure"](https://learn.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=flask%2Cwindows%2Cazure-cli%2Clocal-git-deploy%2Cdeploy-instructions-azportal%2Cterminal-bash%2Cdeploy-instructions-zip-azcli#3---deploy-your-application-code-to-azure),
41-
an [application-scope credential](https://learn.microsoft.com/en-us/azure/app-service/deploy-configure-credentials?tabs=portal#appscope)
42-
will be automatically created with the shape as `your_app_name\$your_app_name`.
43-
But your actual git username is only the `$your_app_name` part.
44-
4540
* [Configure your app's settings](https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal#configure-app-settings) to define [these environment variables](https://github.com/Azure-Samples/ms-identity-python-webapp/blob/main/.env.sample).
4641

42+
* If your `app_config.py` contains `SESSION_TYPE = "filesystem"`,
43+
you shall turn on "session affinity" (a.k.a. "ARR affinity") in your
44+
[App Service Web App's Configuration](https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal#configure-general-settings)
45+
4746

4847
## Contributing
4948

app_config.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,11 @@
4242

4343
# Tells the Flask-session extension to store sessions in the filesystem
4444
SESSION_TYPE = "filesystem"
45-
# Using the file system will not work in most production systems,
46-
# it's better to use a database-backed session store instead.
45+
# In production, your setup may use multiple web servers behind a load balancer,
46+
# and the subsequent requests may not be routed to the same web server.
47+
# In that case, you may either use a centralized database-backed session store,
48+
# or configure your load balancer to route subsequent requests to the same web server
49+
# by using sticky sessions also known as affinity cookie.
50+
# [1] https://www.imperva.com/learn/availability/sticky-session-persistence-and-cookies/
51+
# [2] https://azure.github.io/AppService/2016/05/16/Disable-Session-affinity-cookie-(ARR-cookie)-for-Azure-web-apps.html
52+
# [3] https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal#configure-general-settings

0 commit comments

Comments
 (0)