roemhildtg roemhildtg - 1 year ago 139
Python Question

How to configure flask session behind iis reverse proxy (wfastcgi)?

I'm configuring my flask app to run under iis with a reverse proxy. Basically my setup is like this: ->
Reverse Proxy IIS -> ->
iis (wfastcgi/flask)

The app's urls and content is loading correctly, but anything that deals with a session is not working:

  • Message flashing - no messages are flashed

  • Login cookies - not able to login at all

I've configured the flask app with these relevent config variables:


I have an IIS rewrite rule set up on the external server:

Pattern: (.*)
Rewrite URL:{R:1}

Is there anything else I need to configure to get sessions working correctly?

Answer Source

Not sure if this is the correct way of doing things but apparently excluding the properties SERVER_NAME and SESSION_COOKIE_DOMAIN actually fixes the issue.

Hope this helps someone.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download