# Reach your Hub on your home network only

> Make the Hub reachable on your home network over plain HTTP, what stops working without HTTPS, and how to keep it safe.

Source: https://docs.posternmail.app/reach/lan/

This page makes the Hub answer on your local network, for example at `http://192.168.1.20:8080`,
without HTTPS and without anything reachable from the internet. It is the quickest option, and
the most limited. For the others see [Reaching your Hub](https://docs.posternmail.app/reach/).

> [!TIP]
> **Used the [installer](https://docs.posternmail.app/setup/)?** It does this for you when you choose **This machine's
> address on your network**. It makes the Hub listen on the network and sets its address. To
> switch later, run the installer again and choose **Change how it is set up**.
> This page is for doing it by hand, or for understanding what was set up. With the installer, the
> Docker files are in `/opt/postern` instead of `~/postern`, and the program is
> `/usr/local/bin/postern-hub`.

## What you give up

Without HTTPS:

| | On the LAN over HTTP |
|---|---|
| Web app, password with TOTP | Works |
| **Passkeys** | Not available. The Hub never offers passkeys on plain HTTP, and never on an IP address. |
| **Google sign-in for Gmail** | Not available. Use an app password with IMAP ([Gmail](https://docs.posternmail.app/providers/gmail/)). |
| **Microsoft sign-in in the browser** | Not available. The sign-in with a code still works ([Microsoft](https://docs.posternmail.app/providers/microsoft/)). |
| **Web Push** in the browser | Not available. |
| **Phones** | Only at home, and on Android only with a local host name (see below). Mail itself keeps working away from home, because the apps talk to your providers directly; settings and new devices wait until you are back. |
| **Desktop app** | Warns before it connects (see below). |
| **Privacy on the network** | Your password, session and the mail you read in the web app cross your network unencrypted. Anyone on the same Wi-Fi can read them. |

**Settings → Admin → Status** shows "No HTTPS public URL: passkeys and Google sign-in
unavailable." and `postern-hub doctor` warns "POSTERN_PUBLIC_URL is not HTTPS: passkeys and
Google sign-in are unavailable". Both are expected here.

If any of this matters to you, use [Tailscale](https://docs.posternmail.app/reach/tailscale/) instead: it takes ten minutes more
and gives you HTTPS at home and away.

**Desktop app (built-in Hub):**
The desktop app's built-in Hub cannot be opened to the network. It listens on `127.0.0.1` only
and its address is fixed to `http://localhost:<port>`, so other devices on your LAN cannot
reach it. To share a Hub with your phone or other computers, run it on a server or an always-on
machine as described in [Set up Postern](https://docs.posternmail.app/setup/), then pick that method above.
**Docker Compose, Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
The steps below change the Hub to listen on your network, give it a fixed address, open the
firewall and tell it its URL.

## 1. Give the Hub a fixed address

Your phone and your apps remember the Hub's address. If the router hands the Hub machine a new
IP address after a restart, they lose it. Give the machine a fixed address:

1. Find its current address on the Hub machine:

   ```sh
   hostname -I
   ```

2. In your router's web interface, find the list of DHCP clients (often under **LAN**,
   **Network** or **DHCP**) and reserve the current address for this machine. Routers call
   this a static lease, an address reservation or "always assign this IP address".

This page uses `192.168.1.20` as the example; use yours.

> **Check:** restart the Hub machine. `hostname -I` shows the same address afterwards.

> **If it did not work:** some routers apply a reservation only after the machine renews its
> lease. Restart the machine once more, or set a static address in the machine's network
> settings instead (outside the router's DHCP range).

## 2. Listen on the network

**Docker Compose:**
`POSTERN_BIND` decides which host address Docker publishes the Hub's port on. Add to
`~/postern/.env`:

```sh
POSTERN_BIND=0.0.0.0:8080
```

`8080` alone means the same. To publish only on one network card, use its address:
`POSTERN_BIND=192.168.1.20:8080`.
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
Change `POSTERN_LISTEN` in `/etc/postern/hub.env` (`sudoedit /etc/postern/hub.env`):

```ini
POSTERN_LISTEN=0.0.0.0:8080
```

`0.0.0.0` means every IPv4 address of the machine. To listen on one network card only, use its
address: `POSTERN_LISTEN=192.168.1.20:8080`. For IPv4 and IPv6, use `:8080`.
**Desktop app (built-in Hub):**
Not available for the built-in Hub.

## 3. Tell the Hub its address

Set the address exactly as you will type it, and leave `POSTERN_TRUST_PROXY` off: nothing
proxies the Hub here, and with it on any device on your LAN could fake its IP address.

**Docker Compose:**
Add to `~/postern/.env`:

```sh
POSTERN_PUBLIC_URL=http://192.168.1.20:8080
POSTERN_TRUST_PROXY=false
```

Apply:

```sh
cd ~/postern && docker compose up -d
```
**Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS:**
Add to `/etc/postern/hub.env`:

```ini
POSTERN_PUBLIC_URL=http://192.168.1.20:8080
```

Remove any `POSTERN_TRUST_PROXY=true` line. Apply:

```sh
sudo systemctl restart postern-hub
```
**Desktop app (built-in Hub):**
Not available for the built-in Hub.

If your router gives local names to machines (for example `hub.lan` or `hub.home.arpa`), or
the machine announces itself with mDNS (Raspberry Pi OS does: `raspberrypi.local` by default),
you can use the name instead of the IP address: `POSTERN_PUBLIC_URL=http://hub.lan:8080`. That
helps Android, see [Phones](https://docs.posternmail.app/reach/lan/#phones).

## 4. Open the firewall for your network

**Docker Compose:**
Docker publishes the port with its own firewall rules, which bypass ufw and firewalld: with
`POSTERN_BIND=0.0.0.0:8080` the port is open to every network the host is on, whatever ufw
says. If the host is also reachable from the internet (a VPS, or a router that forwards ports
to it), publish on the LAN address only (`POSTERN_BIND=192.168.1.20:8080`).
**Debian and Ubuntu and Raspberry Pi OS:**
If you use ufw, allow port 8080 from your home network only:

```sh
sudo ufw allow from 192.168.1.0/24 to any port 8080 proto tcp
```

Use your own network range (the first three parts of the Hub's address, then `.0/24`, fits most
home networks). Without a firewall there is nothing to do.
**Fedora and RHEL:**
firewalld blocks port 8080 on Fedora Server. Open it:

```sh
sudo firewall-cmd --permanent --add-port=8080/tcp
sudo firewall-cmd --reload
```

Fedora Workstation's default zone already allows ports above 1024, so it may work without this.
**Desktop app (built-in Hub):**
Not available for the built-in Hub.

> **Check:** from another computer on your network, open `http://192.168.1.20:8080`. The
> sign-in page or the setup wizard appears. Or, from that computer:
>
> ```sh
> curl -s http://192.168.1.20:8080/api/v1/info
> ```
>
> prints JSON with `"apiVersion":1`.

> **If it did not work:**
> - "Connection refused": the Hub still listens on `127.0.0.1`. On the Hub machine,
>   `sudo ss -tlnp | grep 8080` must show `0.0.0.0:8080` (or `*:8080`), not `127.0.0.1:8080`.
> - The browser waits and times out: a firewall drops the connection (step 4), or the other
>   computer is on a guest Wi-Fi that is separated from the main network.
> - "Cross-origin request rejected" when you change something: you opened the Hub with a
>   different address than `POSTERN_PUBLIC_URL` (for example the name instead of the IP). Use
>   the same one everywhere.

## Desktop app

When you enter `http://192.168.1.20:8080`, the desktop app checks the Hub and then warns:

> **This connection isn't encrypted**
> 192.168.1.20:8080 uses plain HTTP, so your password and mail travel unprotected over the
> network. Prefer HTTPS (a reverse proxy) or Tailscale.

Choose **Connect anyway** to continue. The app does not ask for `localhost` and Tailscale
addresses (`*.ts.net`, `100.64.0.0/10`), which are already protected. See
[Desktop app](https://docs.posternmail.app/apps/desktop/).

## Phones

The phone apps allow plain HTTP only to addresses that are on the local network, and the rules
differ between iOS and Android:

| Address | iOS | Android (release builds) |
|---|---|---|
| `http://192.168.1.20:8080` (IP address) | Works | **Blocked** |
| `http://hub.local:8080` (mDNS name) | Works | Works, if the phone resolves `.local` names |
| `http://hub.lan:8080`, `http://hub.home.arpa:8080`, `http://hub.internal:8080` | Blocked | Works |
| `http://hub:8080` (single-word name) | Works | Blocked |

Android can only allow host names, not IP ranges, so a Hub reached by its LAN IP address over
plain HTTP is refused there. If you use Android, give the Hub a `.lan` or `.home.arpa` name in
your router, set that name as `POSTERN_PUBLIC_URL`, and pair with it. Or use HTTPS. Details:
[iOS](https://docs.posternmail.app/apps/ios/), [Android](https://docs.posternmail.app/apps/android/).

Away from home the phone cannot reach the Hub. The app keeps working with your mail (it talks to
your providers directly) and catches up with the Hub when you are back. Push notifications still
arrive, because the Hub sends them out through the push relay ([Push relay](https://docs.posternmail.app/relay/)).

## Never forward plain HTTP to the internet

Do not add a port forwarding for 8080 on your router, and do not use a DMZ setting that sends
everything to the Hub machine. Your password and your mail would then cross the internet
readable, and anyone could try to sign in. If you want to reach the Hub from outside, use
[Tailscale](https://docs.posternmail.app/reach/tailscale/), a [reverse proxy](https://docs.posternmail.app/reach/reverse-proxy/) or
[Cloudflare Tunnel](https://docs.posternmail.app/reach/cloudflare/).
