Skip to content Skip to sidebar Skip to footer

Flask App Running With Gunicorn And Nginx Is Crashing At Redirecting Point

Can you please help? I am stuck. My server is crashing at @return redirect(url_for(‘login’)) ,when I run it using gunicorn i.e. $gunicorn — bind 127.0.0.1:5000 -w 4 wsgi:

Solution 1:

Try using this config, might help you. Create a new file in /etc/nginx/sites-enabled/

server {
        listen80 ;
        server_name abc.com;
        large_client_header_buffers 832k;
  if ($http_user_agent ~* Googlebot) {  
    return403; 
  }
        access_log /var/log/nginx/access.log;
        location / {
                add_header 'Access-Control-Allow-Origin'"$http_origin";
                add_header 'Access-Control-Allow-Methods''GET, POST, OPTIONS, DELETE, PUT';
                add_header 'Access-Control-Allow-Credentials''true';
                add_header 'Access-Control-Allow-Headers''User-Agent,Keep-Alive,Content-Type';
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass https://127.0.0.1:5000;
                proxy_read_timeout 90;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_buffers 832k;
                proxy_buffer_size 64k;
        }
}

use

nginx -t reload

check the config

Post a Comment for "Flask App Running With Gunicorn And Nginx Is Crashing At Redirecting Point"