简体   繁体   中英

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:

external.domain.com:8000 -> 
Reverse Proxy IIS -> 
interal.network.net -> 
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:

SERVER_NAME = 'internal.network.net'
SESSION_COOKIE_DOMAIN = 'external.domain.com'

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

Pattern: (.*)
Rewrite URL: http://internal.network.net/{R:1}

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM