Remote server behind a reverse proxy

A reverse proxy with HTTPS publishes the local server of another computer so you can use it from any browser, without tunnels.

1. How it works

The local server runs on the remote computer as a service, listening only on 127.0.0.1. In front of it, on the same computer, a reverse proxy (for example, Caddy) is the only way in from outside: it encrypts the connection with HTTPS and requires its own key. It recognizes ZeroChat's requests and passes them to the local server; everything else can still go to other services, such as the model server.

There are two independent barriers:

Compared with the SSH tunnel, there is no SSH client or open session to keep, and it works the same from a phone, a tablet or another computer.

2. Prepare the remote computer

The local server as a service

Start zerochat with your user, from the project directory, without opening the browser and without stopping when the tab closes:

zerochat --no-browser --keep-server

The reverse proxy

The proxy has to do three things:

  1. Serve HTTPS with a certificate the browser accepts, because the interface loads from GitHub Pages over HTTPS and the browser blocks unencrypted connections to other computers.
  2. Check its key and pass ZeroChat's requests to the local server on the same computer.
  3. Allow the CORS preflight checks the browser makes before each request, which do not carry the key.

The local server does not need the proxy key: it is best if the proxy does not forward it.

3. Connect from the browser

  1. Open ZeroChat and open the Connection panel (the plug icon next to the settings wheel in the sidebar).
  2. Turn off Local connection and enter the proxy address as the local server URL: only the protocol, name and port, for example https://my-server:12345.
  3. Turn on Use proxy, enter its key and press Connect.
  4. Sign in with the user name and password of the account running zerochat on the remote computer.

4. Sign-in and security

5. Common situations

SituationWhat happens
Connect says the server cannot be reachedThe remote server or the proxy is not responding, or the proxy key is wrong: a proxy that gives no hints to those without the key answers as if nothing were there. Check the URL and the key.
The URL is not acceptedOnly the origin is allowed: https://, the name and the port, without a path.
The page asks you to sign inThe browser had no saved session or the daily token has expired. Sign in again.
Tools fail with an expired authorizationThe browser and remote computer clocks differ by more than 30 s. Turn on automatic date and time on both.