Can you check the sever network configuration and firewall configuration please? Before I had a similar problem with NodeJS server but after fixing firewall configuration using ufw or firewalld, it was fine.
ufw
firewalld