502 bad gateway

Hi,

After upgrading to 5.1 from 4.4, I got a 502 bad gateway error when loading base.

I’m using dev edition.

I read the other forum related talks, but I can’t figure out how to solve my problem.

I found that my dtable-db server do not responds to ping :

# curl --request GET --url https://seatable.<mydomain>/dtable-db/ping --header 'accept: application/json'
<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>

But it’s running :

root@92db1b0958bd:/opt/seatable# ps -ef | grep dtable
root        1171       1  0 11:02 ?        00:00:02 python main.py --config-file /opt/seatable/conf/dtable-events.conf --logfile /opt/seatable/logs/dtable-events.log
root        1177       1  0 11:02 ?        00:00:00 /usr/bin/python3 /opt/seatable/seatable-server-latest/dtable-web/thirdpart/bin/gunicorn seahub.wsgi:application -c /opt/seatable/conf/gunicorn.py
root        1179    1177  0 11:02 ?        00:00:02 /usr/bin/python3 /opt/seatable/seatable-server-latest/dtable-web/thirdpart/bin/gunicorn seahub.wsgi:application -c /opt/seatable/conf/gunicorn.py
root        1190    1177  0 11:02 ?        00:00:02 /usr/bin/python3 /opt/seatable/seatable-server-latest/dtable-web/thirdpart/bin/gunicorn seahub.wsgi:application -c /opt/seatable/conf/gunicorn.py
root        1191    1177  0 11:02 ?        00:00:02 /usr/bin/python3 /opt/seatable/seatable-server-latest/dtable-web/thirdpart/bin/gunicorn seahub.wsgi:application -c /opt/seatable/conf/gunicorn.py
root        1194    1177  0 11:02 ?        00:00:02 /usr/bin/python3 /opt/seatable/seatable-server-latest/dtable-web/thirdpart/bin/gunicorn seahub.wsgi:application -c /opt/seatable/conf/gunicorn.py
root        1195    1177  0 11:02 ?        00:00:02 /usr/bin/python3 /opt/seatable/seatable-server-latest/dtable-web/thirdpart/bin/gunicorn seahub.wsgi:application -c /opt/seatable/conf/gunicorn.py
root        3363    3349  0 11:17 pts/0    00:00:00 grep --color=auto dtable

So I check my nginx.conf, it seems fine to me :

log_format seatableformat '[$time_iso8601] $http_x_forwarded_for $remote_addr "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $upstream_response_time';

upstream dtable_servers {
    server 127.0.0.1:5000;
    keepalive 15;
}

server {
    server_name seatable.<mydomain>;
    listen 80;



    # for letsencrypt
    location /.well-known/acme-challenge/ {
        alias /var/www/challenges/;
        try_files $uri =404;
    }

    proxy_set_header X-Forwarded-For $remote_addr;

    location / {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
        add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
        if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
            add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
            return 204;
        }
        proxy_pass         http://127.0.0.1:8000;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        proxy_read_timeout  1200s;
        
        # used for view/edit office file via Office Online Server
        client_max_body_size 0;
        
        access_log      /opt/nginx-logs/dtable-web.access.log seatableformat;
        error_log       /opt/nginx-logs/dtable-web.error.log;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;

        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_request_buffering off;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;

        send_timeout  36000s;

        access_log      /opt/nginx-logs/seafhttp.access.log seatableformat;
        error_log       /opt/nginx-logs/seafhttp.error.log;

    }

    location /media {
        root /opt/seatable/seatable-server-latest/dtable-web;
    }

    location /socket.io {
        proxy_pass http://dtable_servers;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_redirect off;

        proxy_buffers 8 32k;
        proxy_buffer_size 64k;

        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
    
        access_log      /opt/nginx-logs/socket-io.access.log seatableformat;
        error_log       /opt/nginx-logs/socket-io.error.log;

    }

    location /dtable-server {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
        add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
        if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
            add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
            return 204;
        }
        rewrite ^/dtable-server/(.*)$ /$1 break;
        proxy_pass         http://dtable_servers;
        proxy_redirect     off;
        proxy_set_header   Host              $host;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host  $server_name;
        proxy_set_header   X-Forwarded-Proto $scheme;

        # used for import excel
        client_max_body_size 100m;

        access_log      /opt/nginx-logs/dtable-server.access.log seatableformat;
        error_log       /opt/nginx-logs/dtable-server.error.log;
    }

    location /dtable-db/ {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
        add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
        if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin *;
            add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
            add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
            return 204;
        }
        proxy_pass         http://127.0.0.1:7777/;
        proxy_redirect     off;
        proxy_set_header   Host              $host;
        proxy_set_header   X-Real-IP         $remote_addr;
        proxy_set_header   X-Forwarded-For   $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host  $server_name;
        proxy_set_header   X-Forwarded-Proto $scheme;

        access_log      /opt/nginx-logs/dtable-db.access.log seatableformat;
        error_log       /opt/nginx-logs/dtable-db.error.log;
    }
    
    location /api-gateway/ {
        add_header Access-Control-Allow-Origin *;
        add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
        add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
        if ($request_method = 'OPTIONS') {
           add_header Access-Control-Allow-Origin *;
           add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
           add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
           return 204;
        }
        proxy_pass         http://127.0.0.1:7780/;
        proxy_redirect     off;
        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_set_header   X-Forwarded-Host  $server_name;
        proxy_set_header   X-Forwarded-Proto $scheme;
        access_log         /opt/nginx-logs/api-gateway.access.log seatableformat;
        error_log          /opt/nginx-logs/api-gateway.error.log;
    }
}

My dtable_server_config.json includes :

    "redirect_list_rows_api": true,
    "dtable_web_service_url": "https://seatable.<mydomain>/"

And finally restarting does not help.
Any other ideas ?

Did you checked the special upgrade notices - especially for the api-gateway?

Have you succeeded in solving your issues?

I didn’t have time to test last week, I hope I can this week.

Thanks for asking.