当我在本地运行应用程序时,我有几种形式都按预期工作。
但是,当我尝试在通过 nginx 代理的同一个应用程序上使用任何表单时,每个表单都会None
为每个字段返回。
如果我打印form.data
它返回:
{'display_name': None, 'password': None, 'csrf_token': None}
浏览器将表单数据/发布请求数据显示为:
csrf_token: <an actual and matching csrf token>
display_name: jack
password: <the_actual_password>
remember_me: on
submit: Login
nginx 配置的相关部分:
upstream quart_app {
server 10.217.0.130:8651;
}
server {
server_name quart_app.url; # This is a proper url normally
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_certificate /etc/letsencrypt/live/quart_app/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/quart_app/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_stapling on;
ssl_stapling_verify on;
add_header "Strict-Transport-Security" "max-age=15768000";
access_log logs/quart_app.access.log main;
location / {
proxy_pass https://quart_app;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header 'Upgrade' $http_upgrade;
proxy_set_header 'Connection' 'upgrade';
proxy_set_header 'Content-Type' 'text/plain; charset=utf-8';
proxy_set_header 'Accept-Encoding' 'br';
proxy_set_header 'Service-Worker-Allowed' '/';
proxy_set_header 'Pragma' 'public';
proxy_set_header 'Cache-Control' 'public';
proxy_set_header 'Vary' 'Accept-Encoding';
}
}
我知道这与我的 Quart 代码本身无关,因为它是在本地使用开发服务器时可以正常工作的相同代码(git 克隆)。
什么可能导致这种情况发生。