0
覆蓋會議上,我有domain.com的兩個不同的服務器之一,另一個是sub.domain.com,我使用存儲和flask-session以下配置會話:瓶sub.domain.com上domain.com
SERVER_NAME = 'domain.com'
SESSION_COOKIE_DOMAIN = ".domain.com"
# Flask-Session
SESSION_TYPE = 'redis'
SESSION_REDIS = Redis(host='192.168.10.10', port=6379, db=0)
進一步我使用反向代理使用nginx的和:
proxy_set_header Host $host;
當我登入domain.com一切正常,但是當我刷新sub.domain.com,用戶註銷上domain.com(sub.domain .com創建另一個會話並覆蓋由domain.com創建的會話)。身份驗證是通過flask-login完成的,它在domain.com上(sub.domain.com只應該得到它們)。
我不知道發生了什麼問題,我很感激任何幫助。
更新:
我試着不uwsgi運行燒瓶和它的作品,因爲它應該,但是當我uwsgi和nginx的問題仍然存在。我認爲我的uwsgi或nginx配置有問題。
# uwsgi.ini
[uwsgi]
master = true
enable-threads = true
process = 3
plugin = python
socket = /tmp/name.sock
base = /var/www/app
chdir = %(base)
wsgi-file = %(base)/manage.py
callable = app
# nginx.conf
server {
listen 8001;
location/{
include uwsgi_params;
uwsgi_pass unix:///tmp/name.sock;
}
}
兩臺服務器是否運行相同的代碼? – darwindave 2015-02-11 05:34:18
是的,它們是軟鏈接的。 – neelix 2015-02-11 07:57:52
最近我發現問題依然存在,即使在虛擬機上使用自己的服務器(vagrant)。在主機上使用相同的nginx反向代理配置運行相同的代碼時工作得很好。 – neelix 2015-02-11 08:02:10