【发布时间】:2020-12-16 17:54:29
【问题描述】:
您好,这是一个奇怪的问题。当使用flask run 运行时,它不会在我的本地服务器上发生,但是当使用 gunicorn 和 nginx 时,我使用烧瓶 send_file() 方法或 send_from_directory() 来允许用户下载 .pdf 文件我因以下错误而崩溃:
/home/ben/newvenv/lib/python3.7/site-packages/werkzeug/wrappers/base_response.py:479: UserWarning: The "b'session'" cookie is too large: the value was 10004 bytes but the header required 26 extra bytes. The final size was 10030 bytes but the limit is 4093 bytes. Browsers may silently ignore cookies larger than this.
samesite=samesite,
这是我调用此方法的代码:
return send_from_directory(directory= directory,filename=filename, as_attachment=True)
我尝试更新我的 nginx 配置以允许更大的 cookie,但这不起作用,也不是一个理想的解决方案。我错过了什么?这是 nginx 的问题还是我调用烧瓶方法的方式? .pdf 文件不大,只有十页长。
【问题讨论】:
标签: python flask cookies session-cookies