pagekite / PyPagekite

Python implementation of the PageKite remote front-end protocols.
http://pagekite.org/
GNU Affero General Public License v3.0
722 stars 123 forks source link

Raspverry PI gets nc: Proxy error: "HTTP/1.0 503 Unavailable" #69

Closed dhowe closed 4 years ago

dhowe commented 5 years ago

This happens on reboot of the machine, even though pagekite is running correctly as a service. On atempting to ssh in, I get:

nc: Proxy error: "HTTP/1.0 503 Unavailable" ssh_exchange_identification: Connection closed by remote host

Usually after 10 min or so, the problem fixes itself... Any ideas?

BjarniRunar commented 5 years ago

I'm just guessing, but this could happen if the pagekite service starts up before networking is fully enabled on the device. You can verify this theory by looking in /var/log/pagekite.log and check whether right after boot PageKite complains about failed pings or DNS lookups.

On startup, PageKite will perform a few DNS lookups and some ping tests to decide which relay to connect to. If any of those fail because the network isn't yet fully functional, then you basically need to wait for PageKite to retry. Which from the sounds of things, it is doing.

I think this is working as intended, but if reboots are common you might be able to optimize things by postponing the PageKite startup until you're sure the network is functional?

In any case, thank you for reporting this. Probably this is an argument for dropping the legacy SysV init script, and moving to a proper systemd module which clearly expresses a dependency on working networking.

ramonserra commented 5 years ago

Hi.

I have the same problem with several Raspberry pi. But additionally it is intermittent. Indeed, if I wait a little, the connection is established, but minutes later it is disconnected again.

On the other hand, I can't find the file /var/log/pagekite.log

BjarniRunar commented 4 years ago

The default log path is /var/log/pagekite/pagekite.log, if you are using the Debian package. If you are using some other way of launching PageKite then I don't have any advice for you...

As is, I cannot tell whether this is normal or not. Many, many things may cause PageKite's connection to the relay to get disconnected and there's only so much pagekite.py can do to cope. PageKite cannot disable your firewall, it cannot fix a poor Internet connection, it cannot cure government censorship.

It's quite likely there are situations where pagekite.py could do a better job, but without much more detailed bug reports, logs and such, it's impossible for me to say. Sorry!