Nginx Agent Flask project cookie exception, missing

the Nginx+Gunicorn+Flask used for the project has been successfully deployed to the vultr server and can be accessed by the external network. There is no problem with using flask built-in server locally, so the problem should be on Nginx

the problem now is that even if I log in (and my password is correct), session seems to be lost after jumping from the login interface / login (Flask redirect redirect ()) to the root directory / . Originally, the backend Flask will judge the value of session, but if I have logged in, it will display a different interface, but now the interface is not logged in.

there is also a strange phenomenon: at this time, as soon as the root directory is refreshed, the session seems to be there again, and there is no more refresh. There is no such phenomenon in other directories

attempted to configure Nginx, invalid

proxy_cookie_path / /login;

current Nginx configuration file
/ etc/nginx/nginx.conf

server {
        listen       80;-sharp 80 default_server;
        -sharplisten       [::]:80 default_server;
        server_name  _;
        -sharp root         /usr/share/nginx/html;

        -sharp Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
                proxy_pass http://127.0.0.1:8000; -sharp Gunicorn
                proxy_set_header Host $host:$server_port;
                proxy_set_header Cookie $http_cookie;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                -sharp proxy_cookie_path / /login;
                client_max_body_size 5M;
        }

just launched the website, urgent, please consult everyone!

Jun.25,2022
Menu