Tiw*_*ari 3 python django google-app-engine
如何在 python 中的 WSGI 应用程序上设置安全 Cookie 使用安全 Cookie 我的意思是一个只能在 https 上读取的
该Response.set_cookie函数接受一个可选secure参数。例子:
>>> res.set_cookie('key', 'value', max_age=360, path='/',
... domain='example.org', secure=True)
>>> res.headers['Set-Cookie']
'key=value; Domain=example.org; Max-Age=360; Path=/; expires=... GMT; secure'
Run Code Online (Sandbox Code Playgroud)
您可以secure=True在使用 HTTPS 的情况下使用。
请参阅此处了解更多详情。